GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing plotly.com — Carpet plots in Python Set X and Y Coordinates¶To set the In [1]:
import plotly.graph_objects as go fig = go.Figure(go.Carpet( y = [2, 3.5, 4, 3, 4.5, 5, 5.5, 6.5, 7.5, 8, 8.5, 10] )) fig.show() Add Parameter Values¶To save parameter values use the In [2]:
import plotly.graph_objects as go fig = go.Figure(go.Carpet( a = [4, 4, 4, 4.5, 4.5, 4.5, 5, 5, 5, 6, 6, 6], b = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3], y = [2, 3.5, 4, 3, 4.5, 5, 5.5, 6.5, 7.5, 8, 8.5, 10] )) fig.show() Add A and B axis¶Use In [3]:
import plotly.graph_objects as go fig = go.Figure(go.Carpet( a = [4, 4, 4, 4.5, 4.5, 4.5, 5, 5, 5, 6, 6, 6], b = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3], y = [2, 3.5, 4, 3, 4.5, 5, 5.5, 6.5, 7.5, 8, 8.5, 10], aaxis = dict( tickprefix = 'a = ', ticksuffix = 'm', smoothing = 1, minorgridcount = 9, ), baxis = dict( tickprefix = 'b = ', ticksuffix = 'pa', smoothing = 1, minorgridcount = 9, ) )) fig.show() Alternate input format¶The data arrays In [4]:
import plotly.graph_objects as go fig = go.Figure(go.Carpet( a = [4, 4.5, 5, 6], b = [1, 2, 3], y = [[2, 3, 5.5, 8], [3.5, 4.5, 6.5, 8.5], [4, 5, 7.5, 10]] )) fig.show() Cheater plot layout¶The layout of cheater plots is not unique and depends upon the In [5]:
import plotly.graph_objects as go fig = go.Figure(go.Carpet( a = [4, 4.5, 5, 6], b = [1, 2, 3], y = [[2, 3, 5.5, 8], [3.5, 4.5, 6.5, 8.5], [4, 5, 7.5, 10]], cheaterslope = -5, aaxis = dict(cheatertype = 'index'), baxis = dict(cheatertype = 'value') )) fig.show() Style A and B axis¶In [6]:
import plotly.graph_objects as go fig = go.Figure(go.Carpet( a = [4, 4, 4, 4.5, 4.5, 4.5, 5, 5, 5, 6, 6, 6], b = [1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3], y = [2, 3.5, 4, 3, 4.5, 5, 5.5, 6.5, 7.5, 8, 8.5, 10], aaxis = dict( tickprefix = 'a = ', ticksuffix = 'm', smoothing = 1, minorgridcount = 9, minorgridwidth = 0.6, minorgridcolor = 'white', gridcolor = 'white', color = 'white' ), baxis = dict( ticksuffix = 'Pa', smoothing = 1, minorgridcount = 9, minorgridwidth = 0.6, gridcolor = 'white', minorgridcolor = 'white', color = 'white' ) )) fig.update_layout( plot_bgcolor = 'black', paper_bgcolor = 'black', xaxis = dict( showgrid = False, showticklabels = False ), yaxis = dict( showgrid = False, showticklabels = False ) ) fig.show() Add Points and Contours¶To add points and lines see Carpet Scatter Plots or to add contours see Carpet Contour Plots Reference¶See https://plotly.com/python/reference/carpet/ for more information and chart attribute options! What About Dash?¶Dash is an open-source framework for building analytical applications, with no Javascript required, and it is tightly integrated with the Plotly graphing library. Learn about how to install Dash at https://dash.plot.ly/installation. Everywhere in this page that you see import plotly.graph_objects as go # or plotly.express as px fig = go.Figure() # or any Plotly Express function e.g. px.bar(...) # fig.add_trace( ... ) # fig.update_layout( ... ) from dash import Dash, dcc, html app = Dash() app.layout = html.Div([ dcc.Graph(figure=fig) ]) app.run(debug=True, use_reloader=False) # Turn off reloader if inside Jupyter
|
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |