julia> fig.plot.layout
layout with fields margin, template, xaxis1, xaxis2, yaxis1, and yaxis2
The [...] or hcat function for plots ignores showlegend (and possibly also other layout configurations).
julia> relayout!(fig, showlegend=false)
fixes this in your case. The [...] or hcat functions are Julia only methods for creating subplots. The Plotly-supported methods are more tedious, but are flexible and perhaps have less surprises.
thank you so much for taking the time to give me so many approaches to check out. Is there a reason that just putting showlegend=false into the Layout call doesnāt work? It just seems cleaner to me.
thank you @stephancb
Iāll cerainly look into hcat but I am on the cusp of bypassing Plotlyjs and using Plots instead. Iām hitting all sorts of issues with Plotlyjs and as a noob I like simplicity. Thank you for your reply it has given me something to look into. I would not have determined that hcat would be involved in this.
thanks again
What is really cool, are the interactive html-plots that you can generate with Plotly/PlotlyJS.
What I also like is the good support for multiple axis.
If you would like to have fancy LaTeX-formula in your figures you might skip PlotlyJS,
as currently the LaTeX-support does only work for html-output.
I use PlotlyJS also for static vector graphic plots (*.pdf, *.svg).
Below an example with transparent background and greek letters,
it demonstrates also the limitations of PlotlyJS.
The question about showlegend=false inside the Layout-section was already
commented by @stephancb:
Hi there @ellocco
thank you so much for taking the time to give a noob things to consider based on experience. Iām not expecting to use Latex in any way as my needs are VERY simple as I adhere to Tufte rules.
thank you so much for the EXCELLENT example code, this REALLY helps a noob as it gives us something to tinker with. Iāll see if I can just get it to plot from the cli and not save it. There seems to be a difference between running Plotlyjs code in the cli and the REPL, yet ANOTHER learning opportunity
Iām going to look into the static vector plot side of things thank you for pointing that out.
To be honest I am not sure that I understand why āshowlegend=falseā doesnāt work in my code example. I read @stephancb post but canāt see where that question is addressed. Iām going to follow up with his approach this weekend when I start to experiment with PlutoHooks.jl
The way I see it: PlotlyJS.jl is not yet mature, especially the documentation,
often you need to relay on the examples written in Python and transfer this into the Julia notation.
If I understand @stephancb correctly, his advice is:
if things do not work as expected, try PlotlyJS.relayout!() instead.
Iām going to look into your wonderful examples and @stephancb observations this weekend. Right now Iām wondering if Plots.jl is a better choice given that I tend to strive for simplicity. All I wanted to do was to produce a 10 by 100 subplot with a transparent background. I seem to remember that I did it in python using matplotlib in 10 minutes. That goes to your maturity observation.
Iām VERY enthuastic about Pluto and PlutoHooks and so thatās another component to this app I am considering for julia.
To control the legend you need to set it after combining the subplots to one:
julia> relayout!(fig, showlegend=false)
This is because the [...], which is equivalent to hcat and vcat functions, as overloaded by PlotlyJS.jl does not carry over layout parameters of the subplots.
One of the advantages of PlotlyJS for me is that I can save plots in JSON format for later editing and use. For example, if I need to make presentation slides showing plots that I had previously published in documents and papers, typically the font size of labels and annotations need to be significantly enlarged for better viewing by an audience. Such edits are quite easy with PlotlyJS, as deleting the legend above shows.
You kidding ? Itās amazing to me that you take time to help noobs like me, thanks so much for that. It really does make a difference as learning julia coming from python is a little hard.
I was going to investigate the [ā¦] this weekend and track down what you were highlighting. Iāve been USING julia but not digging into HOW it works. I see this as a learning opportunity. I am still puzzled as to why
doesnāt work but I can move on from that once I understand how you approach works.
My intent is to use a zmq stream of ipms to populate a dataframe and place it in a plutohooks cell then using the Plutoās web api to perform external operations and control the plotting via the notebook.
As you can see, you usecase is mainly static and mine is dynamic.
I want to make sure that your, and the rest of the discourse community, efforts to help people like me ( new to julia coming from python) is so immensely helpful. Without people like you I certainly would have given up when I first started. I can only spend about 1 - 2 hours on actual coding julia a month so though I have been using it for a year I only have 10 - 15 hours of self directed learning. You can see that ANY experienced help will be so appreciated.
thank you SO much for all your support in this issue. Iām going to mark this issue as solved as you both @ellocco and @stephancb advised me to pursue relayout! as the best solution to my issue.
Your worked examples were a positive boon to my and I thank you for taking the time. I use mwe as a learning experience and yours REALLY helped.