Make a nice graph with plotly

How to use plotly I've been using it since the last time, so I'm used to it It feels like setting data in trace and putting it together in Data

scatter.png

scatter


import plotly.plotly as py
from plotly.graph_objs import *

trace = Scatter(x=list(range(10)), y=list(np.random.randint(0,30,10)))
data = Data([trace])
py.image.save_as(data, filename='scatter.png')

bar.png

bar


trace = Bar(x=list(range(10)), y=list(np.random.randint(0,30,10)))
data = Data([trace])
py.image.save_as(data, filename='bar.png')

histogram.png

histogram


trace = Histgram(x=np.random.randn(500))
data = Data([trace])
py.image.save_as(data, filename='histogram.png')

heatmap.png

heatmap


trace = Heatmap(
    z=[np.random.randint(1,50,50) for _ in range(50)],
    colorscale='YIGnBu',
)
data = Data([trace])
py.image.save_as(data, filename='heatmap.png')

bar_scatter.png

multiple_chart


trace = Bar(x=list(range(8)), y=list(np.random.randint(0,10,8)))
trace2 = Scatter(x=list(range(8)), y=list(np.random.randint(0,10,8)))
data = Data([trace, trace2])
py.image.save_as(data, filename='multiple.png')

fap.png

field_area_plots


trace = Scatter(
    x=list(range(8)),
    y=list(np.random.randint(0,10,8)),
    fill='tonexty',
    mode='none'
)
trace2 = Scatter(
    x=list(range(8)),
    y=list(np.random.randint(0,10,8)),
    fill='tonexty',
    mode='none'
)
data = Data([trace, trace2])
py.image.save_as(data, 'field_area_plots.png')

Recommended Posts

Make a nice graph with plotly
Let's make a graph with python! !!
[Python] Make a graph that can be moved around with Plotly
A memo that made a graph animated with plotly
Draw a graph with NetworkX
Create graph with plotly button
Make a fortune with Python
Make a fire with kdeplot
Draw a graph with Julia + PyQtGraph (2)
Publish nice graphs online with plotly
Let's make a GUI with python.
Make a sound with Jupyter notebook
Draw a loose graph with matplotlib
Let's make a breakout with wxPython
Draw a graph with Julia + PyQtGraph (1)
Draw a graph with Julia + PyQtGraph (3)
Draw a graph with pandas + XlsxWriter
Make a filter with a django template
Let's make a supercomputer with xCAT
[Visualization] I want to draw a beautiful graph with Plotly
Make a model iterator with PySide
Draw a graph with PySimple GUI
Make a currency chart that can be moved around with Plotly (2)
Make a currency chart that can be moved around with Plotly (1)
Let's make a shiritori game with Python
Make a video player with PySimpleGUI + OpenCV
[PyQt] Display a multi-axis graph with QtChart
Make a rare gacha simulator with Flask
Make a Notebook Pipeline with Kedro + Papermill
Make a partially zoomed figure with matplotlib
Make a drawing quiz with kivy + PyTorch
Let's make a voice slowly with Python
Make a cascade classifier with google colaboratory
Let's make a simple language with PLY 1
Make a logic circuit with a perceptron (multilayer perceptron)
Make a GIF animation with folder monitoring
Let's make a web framework with Python! (1)
Let's make a tic-tac-toe AI with Pylearn 2
Make a desktop app with Python with Electron
Let's make a Twitter Bot with Python!
Write a nice pie chart with matplotlib
Let's make a web framework with Python! (2)
Draw a graph with PyQtGraph Part 1-Drawing
Create a graph with borders removed with matplotlib
Draw a flat surface with a matplotlib 3d graph
A memorandum to make WebDAV only with nginx
Draw a graph with Japanese labels in Jupyter
Investment quest: Make a system trade with pyhton (2)
Make a Twitter trend bot with heroku + Python
How to draw a 2-axis graph with pyplot
Make a monitoring device with an infrared sensor
Make a simple pixel art generator with Flask
Draw a graph with PyQtGraph Part 3-PlotWidget settings
[Python] Draw a directed graph with Dash Cytoscape
Investment quest: Make a system trade with pyhton (1)
How to make a dictionary with a hierarchical structure.
Try to make a "cryptanalysis" cipher with Python
[Python] Make a simple maze game with Pyxel
Draw a graph with PyQtGraph Part 4-PlotItem settings
Let's replace UWSC with Python (5) Let's make a Robot
Try to make a dihedral group with Python