Comments (14)
This can be done using one of Plotly.plot
's (currently poorly documented) config arguments.
The full list is found here: https://github.com/plotly/plotly.js/blob/master/src/plot_api/plot_config.jshttps://github.com/plotly/plotly.js/blob/master/src/plot_api/plot_config.js
Plotly.plot(graphDiv, data, layout, {staticPlot: true})
should do the trick.
Moreover, note that in svg 2d plots, individual axis can be made fixed using the fixedrange
attribute: https://github.com/plotly/plotly.js/blob/master/src/plots/cartesian/layout_attributes.js#L84 .
from plotly.js.
In case anyone comes looking for this feature like I did for Choropleth plots:
- The option to disable panning:
dragMode=False
in the layout property - The option to disable scrolling:
scrollZoom=False
in the config property - The option to disable map controls:
displayModeBar=False
in the config property
from plotly.js.
If you pass staticPlot: true
, you can't disable it. So if you're creating a plot and want to disable it until data is received, even if you pass staticPlot: false
afterwards, data doesn't update. So, this doesn't really resolve the issue of disabling user interaction for plots that are updated frequently.
from plotly.js.
@xanderwallace85 I used from plotly import graph_objects as go
and constructed the map with fig = go.Choropleth()
from plotly.js.
fig.show(config=dict({'staticPlot':True}))
Looks like that works for offline plots.
from plotly.js.
Thank you for pointing me to the code for this. I can see there's also a displayModeBar
option, so that answers all my questions.
from plotly.js.
FYI, here are some examples of most of the configuration options: https://plot.ly/javascript/configuration-options/
from plotly.js.
Is this option available in python offline version?
from plotly.js.
Yes, for python is also possible, just pass "config" dict to the plot.
Pyplot.plot(data, config={'displayModeBar':False, ....})
from plotly.js.
Can this be done for a specific trace?
There might be a better approach for what I want:
- as trace0 lot of scatter points as background without interactivity or legend
- as trace1, some selected subset with full interactivity
from plotly.js.
@PabloBotas you can adding your own custom legend click handlers. See #2581
from plotly.js.
In case anyone comes looking for this feature like I did for Choropleth plots:
- The option to disable panning:
dragMode=False
in the layout property- The option to disable scrolling:
scrollZoom=False
in the config property- The option to disable map controls:
displayModeBar=False
in the config property
Hi @jaspersardonicus ! Which module did you use for the Choropleth map? When relying on plotly.express dragMode=False throws an error when placed in the layout :(
from plotly.js.
@xanderwallace85 I used
from plotly import graph_objects as go
and constructed the map withfig = go.Choropleth()
@jaspersardonicus Thanks! Have you also tried to disable pan/drag with plotly.express?
from plotly.js.
Not yet. I haven't even used plotly.express yet, sorry!
from plotly.js.
Related Issues (20)
- Mismatch between legend and line colors when using uppercase css colors HOT 1
- Item toggle behavior when using multiple legends HOT 8
- insiderange on multiple overlaid axes edge case
- [Feature Request] Adding a Button to Copy Image to Clipboard HOT 1
- BUG: standoff causes axis title position to break if no tick labels
- Shapes - fill to infinity/-infinity
- Adding a dendrogram to heatmaps
- Smith Chart (scattersmith) pan & zoom functionality HOT 2
- axes range not working. Range is +-1, data is 0->1.6e10 HOT 3
- ScatterGL throws ` TypeError: r[v] is undefined` when using frames HOT 1
- Clicks are sometimes missed with clickmode layout key HOT 4
- Tooltip pointer (triangle) not correctly positioned with hovermode 'x'
- Plotly chart conflict with touchstart / touchmove event to scroll smartphone screen HOT 1
- [BUG] Rangeslider won't reset after zooming out HOT 1
- Inconsistent behavior when providing an array of marker sizes in "markers" mode on scatter3D
- hoverdistance broken in 3D scatter plots; hover radius vs click radius?
- `scattergl` line plots no longer working after upgrading to 2.29.1 HOT 3
- Combining rangemode tozero and tickformat set to "," produces unexpected results
- REOPENING BUG - pie chart hover label hidden
- Hoverlabel overlaps each other
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plotly.js.