Comments (6)
Thanks for the feedback! Yes, it should be possible. We actually recently added this feature!
You might have an outdated version. Try simply upgrading and running your script again?
pip install --upgrade plotly
If that doesn't fix it, drop another note here with a replicable code snippet and we can go from there.
from plotly.py.
I should also note that there is a still a bug that prevents checking if there is no axis line but there are ticks. The default behavior on this figure conversion is to hide the ticks. Just as a heads up.
from plotly.py.
I upgraded latest plotly version 1.1.2 but it does not work. You can see my problem by running code:
-- coding: utf-8 --
import plotly.plotly as py
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
py.sign_in('USERNAME', 'KEY ID')
mpl_fig_splt2 = plt.figure() # set new mpl figure object
On a 3x3 subplot grid
gs = gridspec.GridSpec(3, 3)
gs.update(wspace=0.5, hspace=0.5) # vertical and horizontal spacing
Subplot 1, top-left
ax1 = mpl_fig_splt2.add_subplot(gs[0,0])
ax1.plot([1,2,3,4,5], [10,5,10,5,10], 'r-', label='sbplt 1')
Subplot 2, top-middle
ax2 = mpl_fig_splt2.add_subplot(gs[0,1])
ax2.plot([1,2,3,4,5], [10,5,10,5,10], 'r-', label='sbplt 2')
Subplot 3, top-right
ax3 = mpl_fig_splt2.add_subplot(gs[0,2])
ax3.plot([1,2,3,4,5], [10,5,10,5,10], 'r-', label='sbplt 3')
Subplot 4, line 2-left
ax4 = mpl_fig_splt2.add_subplot(gs[1,0])
ax4.plot([1,2,3,4,5], [10,5,10,5,10], 'r-', label='sbplt 4')
Subplot 5, line 2-middle
ax5 = mpl_fig_splt2.add_subplot(gs[1,1])
ax5.plot([1,2,3,4,5], [10,5,10,5,10], 'r-', label='sbplt 5')
Subplot 6, line 2-right
ax6 = mpl_fig_splt2.add_subplot(gs[1,2])
ax6.plot([1,2,3,4,5], [10,5,10,5,10], 'r-', label='sbplt 6')
Subplot 7, top over all columns
ax7 = mpl_fig_splt2.add_subplot(gs[2,:])
ax7.plot([1,2,3,4,5], [10,5,10,5,10], 'r-', label='sbplt 7')
NEXT DOES NOT WORK IN PLOTLY:
ax7.tick_params(size=0.01, width=0.01,colors="red")
ax7.spines["bottom"].set_color("none")
ax7.spines["top"].set_color("none")
ax7.spines["left"].set_color("none")
ax7.spines["right"].set_color("none")
NEXT WORKS IN MATPLOTLIB BUT DOES NOT WORK IN PLOTLY:
ax7.set_axis_off()
mpl_fig_splt2.suptitle("Routanousukokeen tulokset", fontsize=10, fontweight='bold')
ax1.set_title("Routanousu", fontsize=10)
ax1.set_xlabel("Aika t (h)", fontsize=8)
ax1.set_ylabel("Routanousu h (mm)", fontsize=8)
ax2.set_title("Routanoususuhde", fontsize=10)
ax2.set_xlabel("Aika t (h)", fontsize=8)
ax2.set_ylabel("Routanoususuhde z", fontsize=8)
ax3.set_title("Segregaatiopotentiaali", fontsize=10)
ax3.set_xlabel("Aika t (h)", fontsize=8)
ax3.set_ylabel("SP (mm^2/Kh)", fontsize=8)
ax4.set_title("Roudan syvyys", fontsize=10)
ax4.set_xlabel("Aika t (h)", fontsize=8)
ax4.set_ylabel("Roudan syvyys H (mm)", fontsize=8)
ax5.set_title("Ohjaus (Syotto ja jaahdytys) lampotilat", fontsize=10)
ax5.set_xlabel("Aika t (h)", fontsize=8)
ax5.set_ylabel("Lampotilat T (C)", fontsize=8)
ax6.set_title("Naytteen (15,35,55,75,95 mm) lampotilat", fontsize=10)
ax6.set_xlabel("Aika t (h)", fontsize=8)
ax6.set_ylabel("Lampotila T (C)", fontsize=8)
ax7.set_axis_off() WORKS IN MATPLOLIB
plt.show()
ax7.set_axis_off() DOES NOT WORK IN PLOTLY
py.plot_mpl(mpl_fig_splt2, filename='s6_subplots2', fileopt='overwrite')
from plotly.py.
@vpekkala:
Okay, I just ran a notebook that shows the (1) the mpl figure, (2) the first conversion that's a little buggy, and (3) an updated version. Have a look and let me know if things still aren't looking right!
http://nbviewer.ipython.org/gist/theengineear/c059c673d362705063ab
from plotly.py.
I am confirming the bug: the bottom plotly subplot erroneously contains ticks and ticks labels.
One can get around this bug --- without resorting to the web GUI --- by adding the following lines of code to the above:
update = dict(layout=dict(
xaxis7 = dict(
ticks='',
showticklabels=False
),
yaxis7 = dict(
ticks='',
showticklabels=False
)
))
py.plot_mpl(mpl_fig_splt2, update=update, filename='s6_subplots2')
which updates the plotly figure object with the specifications in update
before plotting.
from plotly.py.
Thanks a lot! Now it works fine. This bug can be closed. Still I recommend you to make this change work so that adding "ax7.set_axis_off()" is enough, i.e. without need to add update part into matplotlib code (easier life atleast to unexperienced coders like me...)
from plotly.py.
Related Issues (20)
- Docs: "Download as HTML" recommends using a `data:` URL, which is restricted in Dash>=2.15.0 HOT 1
- multiple Legends not working in VS code HOT 2
- px.strip jitter doesn't work as expected due to underlying go.Box config HOT 1
- The color of Scattergl points are missing when using animation HOT 1
- tickmode='sync' option is not working as intended
- Cannot provide custom HTTP headers (e.g. bearer token) to Mapbox layer source HOT 2
- `Legendrank` does not work in plotly (pyscript) when `fill` argument is used HOT 2
- Test dependency versions are out of date
- why isn't fig.update_zaxes implimented
- Hover data not displaying on plotly map HOT 1
- plotly.express.scatter_geo() function cannot generate world map HOT 1
- Plotly legends cutoff in Quarto Dashboards
- Opacity and color not working together in px.scatter HOT 1
- Clarify installation of jupyterlab-plotly extension in documentation for JupyterLab 3.x HOT 2
- Making Radar Charts: make_trace_kwargs uses df.append which has been deprecated in pandas 2.0 HOT 1
- zorder doesn't work on version 5.21.0 HOT 5
- Shared X-axis spike remove tick marks from other subplots in Plotly?
- Update docs for using Jupyter HOT 1
- [Plotly Surface] Weird behavior of hover text for surfacecolor HOT 1
- Adding secondary-y latex legend name shifts x-axis coordinates
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.py.