- Plotly - Discussion
- Plotly - Useful Resources
- Plotly - Quick Guide
- Plotly with Matplotlib and Chart Studio
- Plotly with Pandas and Cufflinks
- Plotly - FigureWidget Class
- Plotly - Slider Control
- Plotly - Adding Buttons/Dropdown
- Plotly - 3D Scatter & Surface Plot
- Plotly - OHLC Chart Waterfall Chart & Funnel Chart
- Plotly - Polar Chart & Radar Chart
- Plotly - Heatmap
- Plotly - Distplots, Density Plot & Error Bar Plot
- Plotly - Box Plot Violin Plot & Contour Plot
- Plotly - Histogram
- Plotly - Dot Plots & Table
- Plotly - Scatter Plot, Scattergl Plot & Bubble Charts
- Plotly - Bar Chart & Pie Chart
- Plotly - Subplots & Inset Plots
- Plotly - Format Axis & Ticks
- Plotly - Legends
- Plotly - Exporting to Static Images
- Plotly - Package Structure
- Plotting Inline with Jupyter Notebook
- Plotly - Online & Offline Plotting
- Plotly - Environment Setup
- Plotly - Introduction
- Plotly - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Plotly with Matplotpb and Chart Studio
This chapter deals with data visuapzation pbrary titled Matplotpb and onpne plot maker named Chart Studio.
Matplotpb
Matplotpb is a popular Python data visuapzation pbrary capable of producing production-ready but static plots. you can convert your static matplotpb figures into interactive plots with the help of mpl_to_plotly() function in plotly.tools module.
Following script produces a Sine wave Line plot using Matplotpb’s PyPlot API.
from matplotpb import pyplot as plt import numpy as np import math #needed for definition of pi x = np.arange(0, math.pi*2, 0.05) y = np.sin(x) plt.plot(x,y) plt.xlabel("angle") plt.ylabel("sine") plt.title( sine wave ) plt.show()
Now we shall convert it into a plotly figure as follows −
fig = plt.gcf() plotly_fig = tls.mpl_to_plotly(fig) py.iplot(plotly_fig)
The output of the code is as given below −
Chart Studio
Chart Studio is an onpne plot maker tool made available by Plotly. It provides a graphical user interface for importing and analyzing data into a grid and using stats tools. Graphs can be embedded or downloaded. It is mainly used to enable creating graphs faster and more efficiently.
After logging in to plotly’s account, start the chart studio app by visiting the pnk
. The web page offers a blank work sheet below the plot area. Chart Studio lets you to add plot traces by pushing + trace button.Various plot structure elements such as annotations, style etc. as well as facipty to save, export and share the plots is available in the menu.
Let us add data in the worksheet and add choose bar plot trace from the trace types.
Cpck in the type text box and select bar plot.
Then, provide data columns for x and y axes and enter plot title.
Advertisements