-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
layout does not work properly with Plots #15
Comments
Short AnswerFor the moment: InspectDR only supports Plot.jl's layout functionnality when you save a figure. It does not support this feature on with the interactive GUI mode. To save a figure, add the following line to your code:
Long AnswerThough you simply specified a (# row, # column) format for your plot's layout, Plots.jl supports very arbitrary layouts. Sadly, this flexibility in layouts is not very conducive to the way the Gtk gridding widget works. So for that reason, I have opted not to support the layout feature from the GUI mode. The GUI is very much targeting interactive use - where presentation is not as important as making each plot easy to "explore". WorkaroundIn its GUI, InspectDR currently only plots row-by-row - but it does allow the user to change the amount of columns used when displaying plots. To modify this number of columns, you must access the plot object directly:
*** Note the use of ";" to supress |
I need the vertical layout (multiple rows of plots) because the data share the same x but with y values in different scales. Are there other ways of doing it? I don't quite understand your words "InspectDR currently only plots row-by-row". As I can see, it only has one row of plots. I tried your workaround, but it doesn't seem to change anything on the plots. |
"InspectDR currently only plots row-by-row":The InspectDR GUI creates subplots from left-to-right, filling all slots in a row up until the maximum number of columns (given by Once "ncolumns" is reached, InspectDR creates a new row, and starts filling that one from left-to-right, [repeat for other rows]. For example, plotting 4 subplots with Plotting 4 subplots with Plotting 4 subplots with Workaround
|
Multiple y axes:InspectDR natively supports multiple y axes (called "strips"). You can see a few examples here:
You can find the code used to generate these plots under the sample directory:
The neat thing about using these y "strips" is that InspectDR always keeps the x axes of the strips tied together - even when interactively zooming with the mouse!! Sadly, Plots.jl does not natively support this feature - so you would have to use InspectDR directly. ...but on the bright side, InspectDR runs much faster if you do not have to load Plots.jl (especially its time-to-first-plot). PS Though I find the Plots.jl interface to be much better (simpler) when plotting from the command line, the InspectDR API is often adequate when you build scripts. |
This is how I tried your workaround:
I still get two plots in one row. Actually, I got two windows one behind the other. The plots are on the front window, and in the back window there are some text Do I still need to save the figure here? If that is the case, then perhaps I don't want to do that because it defies the purpose of interactivity, doesn't it? |
The strips feature sounds very neat. I was actually just looking at it. Perhaps I should adopt InspectDR directly in my script. |
Correct. the
No. as you say, a saved image has zero-interactivity... but that's the thing about InspectDR at the moment. It is either supports layout, or interactivity (unless you use the vertically stacked "strips"). Note, however, that the image exported with |
I think most people would really like the strips feature. I wish all plotting packages had this. I find I often want to use this pattern to display plots - and that plotting apps are much easier to use if they support strips natively. PLUS: The neat thing about the strips in InspectDR is that every subplot can be drawn with strips. So, for example, you can easily generate a "multi-plot" window where plots FYI
|
Very sorry. I tried your snippet above and saw your problem. Here is the solution:
Note that the line |
...And I just realize you can make the process less invasive (use more of Plots.jl's normal flow) by using the following:
Note that you might see glitch using this "flow" - because Plots.jl first displays the plot with 2 columns, then we overwrite that setting & refresh. |
Thanks so much for your kind guidance. Another question: how to draw line segments? |
I am probably not answering the right question, but here goes: A line segment is typically drawn as a two-point dataset that represents
...But something tells me this is not what you are asking. Maybe you are asking how I added the H/V marker lines in demo7.jl (ie the dashed black lines)?: Please be more specific with your question if I have not answered it. |
Sorry for not being very clear. Say I have 4 points, each being defined as (xi, yi), and I want to connect Pts 1 and 2, and 3 and 4, but leave Pts 2 and 3 unconnected. So I can draw Pts 1 and 2 with the statements you outlined above, and draw Pts 3 and 4 separately with the statements. Or are there better ways? |
Well, just in case I what you really want is to create a coarser dashed line that what I currently support: Making coarser (longer) dashesYou can hack in a longer dashed line style by adding to the
Actual line segmentsIf what you want to draw are actual line segments that start/stop at specific coordinates, you can embed NaN values in your vectors, for example:
That way, InspectDR can know which adjacent points are not connected. |
Instead of getting two plots arranged vertically, got two horizontally.
The text was updated successfully, but these errors were encountered: