Quantcast

Plots.jl: layout of several plots, with more than one curve per plot

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
18 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Plots.jl: layout of several plots, with more than one curve per plot

Ferran Mazzanti
Hi,

I'm gathering interest in Plots.jl in order to make complex plotting structures. Just as an example, I have a set of data (called y) and some operations performed on it, stored in arrays of obvious names y2, logy, expy etc...

I have managed to create something that displays one curve per plot

lay = @layout [  a{0.4w} grid(2,2) ]
plot(
[y y2 sqrty logy expy],
layout = lay,
grid   = [true false false false false],
title = ["y" "y^2" "sqrt(y)" "log(y)" "exp(y)"],titleloc="center",titlefont=font(12),
xlims = [(0,12)  (0,10) (0,20) (0,20) (0,12) ],
)

which puts one curve in each plot. What would be the needed modifications here in order to
plot y and cosy in the first plot, and sqrty and siny on the second plot?

Thanks for your help,

Ferran.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Plots.jl: layout of several plots, with more than one curve per plot

Scott T
You can break down the plot command into chunks and then call plot on those chunks to build up a plot from several pieces. In this way, you can make individual plots with multiple series. Then you can combine them according to your desired layout.

This isn't the best place to post a full example so I put a notebook up for you to have a look at here: 

Cheers,
Scott

On Tuesday, 8 November 2016 09:20:39 UTC, Ferran Mazzanti wrote:
Hi,

I'm gathering interest in Plots.jl in order to make complex plotting structures. Just as an example, I have a set of data (called y) and some operations performed on it, stored in arrays of obvious names y2, logy, expy etc...

I have managed to create something that displays one curve per plot

lay = @layout [  a{0.4w} grid(2,2) ]
plot(
[y y2 sqrty logy expy],
layout = lay,
grid   = [true false false false false],
title = ["y" "y^2" "sqrt(y)" "log(y)" "exp(y)"],titleloc="center",titlefont=font(12),
xlims = [(0,12)  (0,10) (0,20) (0,20) (0,12) ],
)

which puts one curve in each plot. What would be the needed modifications here in order to
plot y and cosy in the first plot, and sqrty and siny on the second plot?

Thanks for your help,

Ferran.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Plots.jl: layout of several plots, with more than one curve per plot

Ferran Mazzanti
Oh!
Scott you're very kind to take your time helping me with the notebook... thanks a lot. I'll take a careful look and report back if I find problems.
Best,
Ferran.

On Tuesday, November 8, 2016 at 1:22:20 PM UTC+1, Scott T wrote:
You can break down the plot command into chunks and then call plot on those chunks to build up a plot from several pieces. In this way, you can make individual plots with multiple series. Then you can combine them according to your desired layout.

This isn't the best place to post a full example so I put a notebook up for you to have a look at here: 
<a href="https://gist.github.com/swt30/54701d09cfa479dab78a5bc2fa857fd7" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgist.github.com%2Fswt30%2F54701d09cfa479dab78a5bc2fa857fd7\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFZ8SdFF1rw1h2f6x_FgV7r8fvyuQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgist.github.com%2Fswt30%2F54701d09cfa479dab78a5bc2fa857fd7\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFZ8SdFF1rw1h2f6x_FgV7r8fvyuQ&#39;;return true;">https://gist.github.com/swt30/54701d09cfa479dab78a5bc2fa857fd7

Cheers,
Scott

On Tuesday, 8 November 2016 09:20:39 UTC, Ferran Mazzanti wrote:
Hi,

I'm gathering interest in Plots.jl in order to make complex plotting structures. Just as an example, I have a set of data (called y) and some operations performed on it, stored in arrays of obvious names y2, logy, expy etc...

I have managed to create something that displays one curve per plot

lay = @layout [  a{0.4w} grid(2,2) ]
plot(
[y y2 sqrty logy expy],
layout = lay,
grid   = [true false false false false],
title = ["y" "y^2" "sqrt(y)" "log(y)" "exp(y)"],titleloc="center",titlefont=font(12),
xlims = [(0,12)  (0,10) (0,20) (0,20) (0,12) ],
)

which puts one curve in each plot. What would be the needed modifications here in order to
plot y and cosy in the first plot, and sqrty and siny on the second plot?

Thanks for your help,

Ferran.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Plots.jl: layout of several plots, with more than one curve per plot

Tom Breloff
Thanks for putting those examples together Scott.  Do you want to contribute that to ExamplePlots?

Ferran: as Scott has shown nicely, there's an ton of different ways to do what you want, and the "right" way is going to depend on your problem... what the layouts/data look like.  Many times it's easiest to build the plots independently and then just do: plot(p1, p2, p3, p4, p5, layout = ...)

On Tue, Nov 8, 2016 at 11:18 AM, Ferran Mazzanti <[hidden email]> wrote:
Oh!
Scott you're very kind to take your time helping me with the notebook... thanks a lot. I'll take a careful look and report back if I find problems.
Best,
Ferran.


On Tuesday, November 8, 2016 at 1:22:20 PM UTC+1, Scott T wrote:
You can break down the plot command into chunks and then call plot on those chunks to build up a plot from several pieces. In this way, you can make individual plots with multiple series. Then you can combine them according to your desired layout.

This isn't the best place to post a full example so I put a notebook up for you to have a look at here: 

Cheers,
Scott

On Tuesday, 8 November 2016 09:20:39 UTC, Ferran Mazzanti wrote:
Hi,

I'm gathering interest in Plots.jl in order to make complex plotting structures. Just as an example, I have a set of data (called y) and some operations performed on it, stored in arrays of obvious names y2, logy, expy etc...

I have managed to create something that displays one curve per plot

lay = @layout [  a{0.4w} grid(2,2) ]
plot(
[y y2 sqrty logy expy],
layout = lay,
grid   = [true false false false false],
title = ["y" "y^2" "sqrt(y)" "log(y)" "exp(y)"],titleloc="center",titlefont=font(12),
xlims = [(0,12)  (0,10) (0,20) (0,20) (0,12) ],
)

which puts one curve in each plot. What would be the needed modifications here in order to
plot y and cosy in the first plot, and sqrty and siny on the second plot?

Thanks for your help,

Ferran.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Plots.jl: layout of several plots, with more than one curve per plot

Scott T
Sure, happy to add to ExamplePlots! Do you have any more suggestions for layout-related features you'd like to showcase? Inset plots? I think the key things to get across are how to define layouts and how to overlay/facet series within a layout.

Scott


On Tuesday, 8 November 2016 16:28:11 UTC, Tom Breloff wrote:
Thanks for putting those examples together Scott.  Do you want to contribute that to ExamplePlots?

Ferran: as Scott has shown nicely, there's an ton of different ways to do what you want, and the "right" way is going to depend on your problem... what the layouts/data look like.  Many times it's easiest to build the plots independently and then just do: plot(p1, p2, p3, p4, p5, layout = ...)

On Tue, Nov 8, 2016 at 11:18 AM, Ferran Mazzanti <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="7TGhJKvDBAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">ferran....@...> wrote:
Oh!
Scott you're very kind to take your time helping me with the notebook... thanks a lot. I'll take a careful look and report back if I find problems.
Best,
Ferran.


On Tuesday, November 8, 2016 at 1:22:20 PM UTC+1, Scott T wrote:
You can break down the plot command into chunks and then call plot on those chunks to build up a plot from several pieces. In this way, you can make individual plots with multiple series. Then you can combine them according to your desired layout.

This isn't the best place to post a full example so I put a notebook up for you to have a look at here: 
<a href="https://gist.github.com/swt30/54701d09cfa479dab78a5bc2fa857fd7" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgist.github.com%2Fswt30%2F54701d09cfa479dab78a5bc2fa857fd7\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFZ8SdFF1rw1h2f6x_FgV7r8fvyuQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgist.github.com%2Fswt30%2F54701d09cfa479dab78a5bc2fa857fd7\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFZ8SdFF1rw1h2f6x_FgV7r8fvyuQ&#39;;return true;">https://gist.github.com/swt30/54701d09cfa479dab78a5bc2fa857fd7

Cheers,
Scott

On Tuesday, 8 November 2016 09:20:39 UTC, Ferran Mazzanti wrote:
Hi,

I'm gathering interest in Plots.jl in order to make complex plotting structures. Just as an example, I have a set of data (called y) and some operations performed on it, stored in arrays of obvious names y2, logy, expy etc...

I have managed to create something that displays one curve per plot

lay = @layout [  a{0.4w} grid(2,2) ]
plot(
[y y2 sqrty logy expy],
layout = lay,
grid   = [true false false false false],
title = ["y" "y^2" "sqrt(y)" "log(y)" "exp(y)"],titleloc="center",titlefont=font(12),
xlims = [(0,12)  (0,10) (0,20) (0,20) (0,12) ],
)

which puts one curve in each plot. What would be the needed modifications here in order to
plot y and cosy in the first plot, and sqrty and siny on the second plot?

Thanks for your help,

Ferran.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Plots.jl: layout of several plots, with more than one curve per plot

Tom Breloff
Even better... you should add a tutorial for how to do: https://github.com/tbreloff/Plots.jl/issues/541

On Tue, Nov 8, 2016 at 12:00 PM, Scott T <[hidden email]> wrote:
Sure, happy to add to ExamplePlots! Do you have any more suggestions for layout-related features you'd like to showcase? Inset plots? I think the key things to get across are how to define layouts and how to overlay/facet series within a layout.

Scott


On Tuesday, 8 November 2016 16:28:11 UTC, Tom Breloff wrote:
Thanks for putting those examples together Scott.  Do you want to contribute that to ExamplePlots?

Ferran: as Scott has shown nicely, there's an ton of different ways to do what you want, and the "right" way is going to depend on your problem... what the layouts/data look like.  Many times it's easiest to build the plots independently and then just do: plot(p1, p2, p3, p4, p5, layout = ...)

On Tue, Nov 8, 2016 at 11:18 AM, Ferran Mazzanti <[hidden email]> wrote:
Oh!
Scott you're very kind to take your time helping me with the notebook... thanks a lot. I'll take a careful look and report back if I find problems.
Best,
Ferran.


On Tuesday, November 8, 2016 at 1:22:20 PM UTC+1, Scott T wrote:
You can break down the plot command into chunks and then call plot on those chunks to build up a plot from several pieces. In this way, you can make individual plots with multiple series. Then you can combine them according to your desired layout.

This isn't the best place to post a full example so I put a notebook up for you to have a look at here: 

Cheers,
Scott

On Tuesday, 8 November 2016 09:20:39 UTC, Ferran Mazzanti wrote:
Hi,

I'm gathering interest in Plots.jl in order to make complex plotting structures. Just as an example, I have a set of data (called y) and some operations performed on it, stored in arrays of obvious names y2, logy, expy etc...

I have managed to create something that displays one curve per plot

lay = @layout [  a{0.4w} grid(2,2) ]
plot(
[y y2 sqrty logy expy],
layout = lay,
grid   = [true false false false false],
title = ["y" "y^2" "sqrt(y)" "log(y)" "exp(y)"],titleloc="center",titlefont=font(12),
xlims = [(0,12)  (0,10) (0,20) (0,20) (0,12) ],
)

which puts one curve in each plot. What would be the needed modifications here in order to
plot y and cosy in the first plot, and sqrty and siny on the second plot?

Thanks for your help,

Ferran.


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Plots.jl: layout of several plots, with more than one curve per plot

Ferran Mazzanti
Sorry for sneaking in again, but I have tried to extrapolate the examples in the notebook (thanks again Scott) to include a fifth plot below (that is, to get the same structure but with an additional plot at the bottom, spanning the whole width and a smaller height) and fail. I can get it to work when the upper-right grid, which now is 2x2, is reduced to 1x2, but otherwise I can only get a large plot with a smaller one inside...
Is there a (proper) way to get this done?
Thanks again,
Ferran,
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Plots.jl: layout of several plots, with more than one curve per plot

Tom Breloff
"@layout [a grid(2,2); b]" should work

On Friday, November 11, 2016, Ferran Mazzanti <[hidden email]> wrote:
Sorry for sneaking in again, but I have tried to extrapolate the examples in the notebook (thanks again Scott) to include a fifth plot below (that is, to get the same structure but with an additional plot at the bottom, spanning the whole width and a smaller height) and fail. I can get it to work when the upper-right grid, which now is 2x2, is reduced to 1x2, but otherwise I can only get a large plot with a smaller one inside...
Is there a (proper) way to get this done?
Thanks again,
Ferran,
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Plots.jl: layout of several plots, with more than one curve per plot

Ferran Mazzanti
Hi again,

thanks Scott. That doesn't work on my ubuntu machine. Looks like this is too complex a plot, and what I get is a big plot with a single subplot on it. That's whay I was asking for help, actually... If I reduce the grid to 2x1 (so putting 2 plots instead of 4 in the grid), things work well...
So shall I understand there is some sort of bug in the codem, then?

Best,

Ferran.

On Friday, November 11, 2016 at 12:10:02 PM UTC+1, Tom Breloff wrote:
"@layout [a grid(2,2); b]" should work

On Friday, November 11, 2016, Ferran Mazzanti <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="luCFYwyeBQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">ferran....@...> wrote:
Sorry for sneaking in again, but I have tried to extrapolate the examples in the notebook (thanks again Scott) to include a fifth plot below (that is, to get the same structure but with an additional plot at the bottom, spanning the whole width and a smaller height) and fail. I can get it to work when the upper-right grid, which now is 2x2, is reduced to 1x2, but otherwise I can only get a large plot with a smaller one inside...
Is there a (proper) way to get this done?
Thanks again,
Ferran,
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Plots.jl: layout of several plots, with more than one curve per plot

Patrick Kofod Mogensen
Hi Ferran,

First of all, it is so much easier for people to help you if you post the code you don't understand isn't working.

Best,
Patrick

On Monday, November 14, 2016 at 9:35:03 AM UTC+1, Ferran Mazzanti wrote:
Hi again,

thanks Scott. That doesn't work on my ubuntu machine. Looks like this is too complex a plot, and what I get is a big plot with a single subplot on it. That's whay I was asking for help, actually... If I reduce the grid to 2x1 (so putting 2 plots instead of 4 in the grid), things work well...
So shall I understand there is some sort of bug in the codem, then?

Best,

Ferran.

On Friday, November 11, 2016 at 12:10:02 PM UTC+1, Tom Breloff wrote:
"@layout [a grid(2,2); b]" should work

On Friday, November 11, 2016, Ferran Mazzanti <[hidden email]> wrote:
Sorry for sneaking in again, but I have tried to extrapolate the examples in the notebook (thanks again Scott) to include a fifth plot below (that is, to get the same structure but with an additional plot at the bottom, spanning the whole width and a smaller height) and fail. I can get it to work when the upper-right grid, which now is 2x2, is reduced to 1x2, but otherwise I can only get a large plot with a smaller one inside...
Is there a (proper) way to get this done?
Thanks again,
Ferran,
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Plots.jl: layout of several plots, with more than one curve per plot

Ferran Mazzanti
It is a minor variation of the example given by Scott
for some data set y, cosy, y2, sqrty, siny, logy (doesn't matter the values, could be random)

plot_1 = plot([y cosy],
    title  = "Data y",
    xlims  = (0,10),
    ylims  = (-0.1,1.1),
    grid   = true,
    xlabel = "Iteration",
    ylabel = "y & cos(y)"
);

plot_2 = plot(y2,
    title  = "Data y Squared",
    xlims  = (0,10),
    ylims  = (-0.1,0.5),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2",
    legend = false,
);

plot_3 = plot( [sqrty siny],
title  = "Square Root of y",
    xlims  = (0,10),
    ylims  = (-0.1,0.5),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2"
);

plot_4 = plot(logy,
title  = "Log of y",
    xlims  = (0,10),
    ylims  = (-10,0),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2"
);

plot_5 = plot(expy,
title  = "Exp of y",
    xlims  = (0,10),
    ylims  = (1,2),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2"
);

lay = @layout [a grid(2,2); b]
plot( plot_1, plot_2, plot_3, plot_4, plot_5, plot_5, layout = lay )

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Plots.jl: layout of several plots, with more than one curve per plot

Scott T
The layout has space for 6 plots but the final plot command only supplies 5. When I run your example (on the development branch of Plots) I get an error because of that. Have you tried the dev branch? `Pkg.checkout("Plots, "dev")`, restart julia and re-run it.

Scott

On Monday, 14 November 2016 11:29:09 UTC, Ferran Mazzanti wrote:
It is a minor variation of the example given by Scott
for some data set y, cosy, y2, sqrty, siny, logy (doesn't matter the values, could be random)

plot_1 = plot([y cosy],
    title  = "Data y",
    xlims  = (0,10),
    ylims  = (-0.1,1.1),
    grid   = true,
    xlabel = "Iteration",
    ylabel = "y & cos(y)"
);

plot_2 = plot(y2,
    title  = "Data y Squared",
    xlims  = (0,10),
    ylims  = (-0.1,0.5),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2",
    legend = false,
);

plot_3 = plot( [sqrty siny],
title  = "Square Root of y",
    xlims  = (0,10),
    ylims  = (-0.1,0.5),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2"
);

plot_4 = plot(logy,
title  = "Log of y",
    xlims  = (0,10),
    ylims  = (-10,0),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2"
);

plot_5 = plot(expy,
title  = "Exp of y",
    xlims  = (0,10),
    ylims  = (1,2),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2"
);

lay = @layout [a grid(2,2); b]
plot( plot_1, plot_2, plot_3, plot_4, plot_5, plot_5, layout = lay )

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Plots.jl: layout of several plots, with more than one curve per plot

Scott T
Oh my mistake, I see you have supplied plot_5 twice. If I do that, I get the problem you describe.

I'm not quite sure why you'd want to repeat a plot, but it looks like this is causing problems. If you really want to include plot_5 twice, I suggest making a new plot_6 with the same parameters and including that instead.

I'll open a bug report at Plots for this behaviour.

Scott

On Monday, 14 November 2016 11:59:45 UTC, Scott T wrote:
The layout has space for 6 plots but the final plot command only supplies 5. When I run your example (on the development branch of Plots) I get an error because of that. Have you tried the dev branch? `Pkg.checkout("Plots, "dev")`, restart julia and re-run it.

Scott

On Monday, 14 November 2016 11:29:09 UTC, Ferran Mazzanti wrote:
It is a minor variation of the example given by Scott
for some data set y, cosy, y2, sqrty, siny, logy (doesn't matter the values, could be random)

plot_1 = plot([y cosy],
    title  = "Data y",
    xlims  = (0,10),
    ylims  = (-0.1,1.1),
    grid   = true,
    xlabel = "Iteration",
    ylabel = "y & cos(y)"
);

plot_2 = plot(y2,
    title  = "Data y Squared",
    xlims  = (0,10),
    ylims  = (-0.1,0.5),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2",
    legend = false,
);

plot_3 = plot( [sqrty siny],
title  = "Square Root of y",
    xlims  = (0,10),
    ylims  = (-0.1,0.5),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2"
);

plot_4 = plot(logy,
title  = "Log of y",
    xlims  = (0,10),
    ylims  = (-10,0),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2"
);

plot_5 = plot(expy,
title  = "Exp of y",
    xlims  = (0,10),
    ylims  = (1,2),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2"
);

lay = @layout [a grid(2,2); b]
plot( plot_1, plot_2, plot_3, plot_4, plot_5, plot_5, layout = lay )

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Plots.jl: layout of several plots, with more than one curve per plot

Tom Breloff
The behavior is currently undefined if you pass in the same plot twice. Unless there's a compelling reason, I don't think that will change. 

On Monday, November 14, 2016, Scott T <[hidden email]> wrote:
Oh my mistake, I see you have supplied plot_5 twice. If I do that, I get the problem you describe.

I'm not quite sure why you'd want to repeat a plot, but it looks like this is causing problems. If you really want to include plot_5 twice, I suggest making a new plot_6 with the same parameters and including that instead.

I'll open a bug report at Plots for this behaviour.

Scott

On Monday, 14 November 2016 11:59:45 UTC, Scott T wrote:
The layout has space for 6 plots but the final plot command only supplies 5. When I run your example (on the development branch of Plots) I get an error because of that. Have you tried the dev branch? `Pkg.checkout("Plots, "dev")`, restart julia and re-run it.

Scott

On Monday, 14 November 2016 11:29:09 UTC, Ferran Mazzanti wrote:
It is a minor variation of the example given by Scott
for some data set y, cosy, y2, sqrty, siny, logy (doesn't matter the values, could be random)

plot_1 = plot([y cosy],
    title  = "Data y",
    xlims  = (0,10),
    ylims  = (-0.1,1.1),
    grid   = true,
    xlabel = "Iteration",
    ylabel = "y & cos(y)"
);

plot_2 = plot(y2,
    title  = "Data y Squared",
    xlims  = (0,10),
    ylims  = (-0.1,0.5),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2",
    legend = false,
);

plot_3 = plot( [sqrty siny],
title  = "Square Root of y",
    xlims  = (0,10),
    ylims  = (-0.1,0.5),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2"
);

plot_4 = plot(logy,
title  = "Log of y",
    xlims  = (0,10),
    ylims  = (-10,0),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2"
);

plot_5 = plot(expy,
title  = "Exp of y",
    xlims  = (0,10),
    ylims  = (1,2),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2"
);

lay = @layout [a grid(2,2); b]
plot( plot_1, plot_2, plot_3, plot_4, plot_5, plot_5, layout = lay )

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Plots.jl: layout of several plots, with more than one curve per plot

Ferran Mazzanti
Oh, now I see that just by copying plot_5 with a new name plot_6 and replacing

plot( plot_1, plot_2, plot_3, plot_4, plot_5, plot_5, layout = lay )

with

plot( plot_1, plot_2, plot_3, plot_4, plot_5, plot_6, layout = lay ),

it works. But IT IS a bug, there is no reason why should not be able to repeat a plot. You are supposed to be able to plot whatever you want, isn't it? And if you think it makes not sense, then at least one should document it. I could think of many situations where the same plot is repeated... for instance, when learning how to arrange several plots together, and you do not worry about what you plot, just want to see the final arrangement. But if you still think it does not make sense what I say (why not?), it doesn't hurt to document the limitations...

Cheers,

Ferran.


On Monday, November 14, 2016 at 2:50:13 PM UTC+1, Tom Breloff wrote:
The behavior is currently undefined if you pass in the same plot twice. Unless there's a compelling reason, I don't think that will change. 

On Monday, November 14, 2016, Scott T <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="8cNhpYeSBgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">sgseab...@...> wrote:
Oh my mistake, I see you have supplied plot_5 twice. If I do that, I get the problem you describe.

I'm not quite sure why you'd want to repeat a plot, but it looks like this is causing problems. If you really want to include plot_5 twice, I suggest making a new plot_6 with the same parameters and including that instead.

I'll open a bug report at Plots for this behaviour.

Scott

On Monday, 14 November 2016 11:59:45 UTC, Scott T wrote:
The layout has space for 6 plots but the final plot command only supplies 5. When I run your example (on the development branch of Plots) I get an error because of that. Have you tried the dev branch? `Pkg.checkout("Plots, "dev")`, restart julia and re-run it.

Scott

On Monday, 14 November 2016 11:29:09 UTC, Ferran Mazzanti wrote:
It is a minor variation of the example given by Scott
for some data set y, cosy, y2, sqrty, siny, logy (doesn't matter the values, could be random)

plot_1 = plot([y cosy],
    title  = "Data y",
    xlims  = (0,10),
    ylims  = (-0.1,1.1),
    grid   = true,
    xlabel = "Iteration",
    ylabel = "y & cos(y)"
);

plot_2 = plot(y2,
    title  = "Data y Squared",
    xlims  = (0,10),
    ylims  = (-0.1,0.5),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2",
    legend = false,
);

plot_3 = plot( [sqrty siny],
title  = "Square Root of y",
    xlims  = (0,10),
    ylims  = (-0.1,0.5),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2"
);

plot_4 = plot(logy,
title  = "Log of y",
    xlims  = (0,10),
    ylims  = (-10,0),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2"
);

plot_5 = plot(expy,
title  = "Exp of y",
    xlims  = (0,10),
    ylims  = (1,2),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2"
);

lay = @layout [a grid(2,2); b]
plot( plot_1, plot_2, plot_3, plot_4, plot_5, plot_5, layout = lay )

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Plots.jl: layout of several plots, with more than one curve per plot

Tom Breloff
Serious "give a mouse a cookie syndrome".  You can do what you want by calling 'plot_6 = deepcopy(plot_5)' first. 

On Tuesday, November 15, 2016, Ferran Mazzanti <[hidden email]> wrote:
Oh, now I see that just by copying plot_5 with a new name plot_6 and replacing

plot( plot_1, plot_2, plot_3, plot_4, plot_5, plot_5, layout = lay )

with

plot( plot_1, plot_2, plot_3, plot_4, plot_5, plot_6, layout = lay ),

it works. But IT IS a bug, there is no reason why should not be able to repeat a plot. You are supposed to be able to plot whatever you want, isn't it? And if you think it makes not sense, then at least one should document it. I could think of many situations where the same plot is repeated... for instance, when learning how to arrange several plots together, and you do not worry about what you plot, just want to see the final arrangement. But if you still think it does not make sense what I say (why not?), it doesn't hurt to document the limitations...

Cheers,

Ferran.


On Monday, November 14, 2016 at 2:50:13 PM UTC+1, Tom Breloff wrote:
The behavior is currently undefined if you pass in the same plot twice. Unless there's a compelling reason, I don't think that will change. 

On Monday, November 14, 2016, Scott T <[hidden email]> wrote:
Oh my mistake, I see you have supplied plot_5 twice. If I do that, I get the problem you describe.

I'm not quite sure why you'd want to repeat a plot, but it looks like this is causing problems. If you really want to include plot_5 twice, I suggest making a new plot_6 with the same parameters and including that instead.

I'll open a bug report at Plots for this behaviour.

Scott

On Monday, 14 November 2016 11:59:45 UTC, Scott T wrote:
The layout has space for 6 plots but the final plot command only supplies 5. When I run your example (on the development branch of Plots) I get an error because of that. Have you tried the dev branch? `Pkg.checkout("Plots, "dev")`, restart julia and re-run it.

Scott

On Monday, 14 November 2016 11:29:09 UTC, Ferran Mazzanti wrote:
It is a minor variation of the example given by Scott
for some data set y, cosy, y2, sqrty, siny, logy (doesn't matter the values, could be random)

plot_1 = plot([y cosy],
    title  = "Data y",
    xlims  = (0,10),
    ylims  = (-0.1,1.1),
    grid   = true,
    xlabel = "Iteration",
    ylabel = "y & cos(y)"
);

plot_2 = plot(y2,
    title  = "Data y Squared",
    xlims  = (0,10),
    ylims  = (-0.1,0.5),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2",
    legend = false,
);

plot_3 = plot( [sqrty siny],
title  = "Square Root of y",
    xlims  = (0,10),
    ylims  = (-0.1,0.5),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2"
);

plot_4 = plot(logy,
title  = "Log of y",
    xlims  = (0,10),
    ylims  = (-10,0),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2"
);

plot_5 = plot(expy,
title  = "Exp of y",
    xlims  = (0,10),
    ylims  = (1,2),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2"
);

lay = @layout [a grid(2,2); b]
plot( plot_1, plot_2, plot_3, plot_4, plot_5, plot_5, layout = lay )

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Plots.jl: layout of several plots, with more than one curve per plot

Ferran Mazzanti
That's not the point but it doesn't really matter :)

On Tuesday, November 15, 2016 at 12:41:54 PM UTC+1, Tom Breloff wrote:
Serious "give a mouse a cookie syndrome".  You can do what you want by calling 'plot_6 = deepcopy(plot_5)' first. 

On Tuesday, November 15, 2016, Ferran Mazzanti <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="MzX7wRvaBgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">ferran....@...> wrote:
Oh, now I see that just by copying plot_5 with a new name plot_6 and replacing

plot( plot_1, plot_2, plot_3, plot_4, plot_5, plot_5, layout = lay )

with

plot( plot_1, plot_2, plot_3, plot_4, plot_5, plot_6, layout = lay ),

it works. But IT IS a bug, there is no reason why should not be able to repeat a plot. You are supposed to be able to plot whatever you want, isn't it? And if you think it makes not sense, then at least one should document it. I could think of many situations where the same plot is repeated... for instance, when learning how to arrange several plots together, and you do not worry about what you plot, just want to see the final arrangement. But if you still think it does not make sense what I say (why not?), it doesn't hurt to document the limitations...

Cheers,

Ferran.


On Monday, November 14, 2016 at 2:50:13 PM UTC+1, Tom Breloff wrote:
The behavior is currently undefined if you pass in the same plot twice. Unless there's a compelling reason, I don't think that will change. 

On Monday, November 14, 2016, Scott T <[hidden email]> wrote:
Oh my mistake, I see you have supplied plot_5 twice. If I do that, I get the problem you describe.

I'm not quite sure why you'd want to repeat a plot, but it looks like this is causing problems. If you really want to include plot_5 twice, I suggest making a new plot_6 with the same parameters and including that instead.

I'll open a bug report at Plots for this behaviour.

Scott

On Monday, 14 November 2016 11:59:45 UTC, Scott T wrote:
The layout has space for 6 plots but the final plot command only supplies 5. When I run your example (on the development branch of Plots) I get an error because of that. Have you tried the dev branch? `Pkg.checkout("Plots, "dev")`, restart julia and re-run it.

Scott

On Monday, 14 November 2016 11:29:09 UTC, Ferran Mazzanti wrote:
It is a minor variation of the example given by Scott
for some data set y, cosy, y2, sqrty, siny, logy (doesn't matter the values, could be random)

plot_1 = plot([y cosy],
    title  = "Data y",
    xlims  = (0,10),
    ylims  = (-0.1,1.1),
    grid   = true,
    xlabel = "Iteration",
    ylabel = "y & cos(y)"
);

plot_2 = plot(y2,
    title  = "Data y Squared",
    xlims  = (0,10),
    ylims  = (-0.1,0.5),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2",
    legend = false,
);

plot_3 = plot( [sqrty siny],
title  = "Square Root of y",
    xlims  = (0,10),
    ylims  = (-0.1,0.5),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2"
);

plot_4 = plot(logy,
title  = "Log of y",
    xlims  = (0,10),
    ylims  = (-10,0),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2"
);

plot_5 = plot(expy,
title  = "Exp of y",
    xlims  = (0,10),
    ylims  = (1,2),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2"
);

lay = @layout [a grid(2,2); b]
plot( plot_1, plot_2, plot_3, plot_4, plot_5, plot_5, layout = lay )

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Plots.jl: layout of several plots, with more than one curve per plot

Scott T
Hi Tom, just to let you know that I'm putting together some subplot demos for ExamplePlots.jl. I was hoping to show some examples of linking axes, but I got a little overambitious and it's not quite the result I intended. I have popped the question on Discourse if you wanted to take a look. 

Scott

On Wednesday, 16 November 2016 10:39:04 UTC, Ferran Mazzanti wrote:
That's not the point but it doesn't really matter :)

On Tuesday, November 15, 2016 at 12:41:54 PM UTC+1, Tom Breloff wrote:
Serious "give a mouse a cookie syndrome".  You can do what you want by calling 'plot_6 = deepcopy(plot_5)' first. 

On Tuesday, November 15, 2016, Ferran Mazzanti <[hidden email]> wrote:
Oh, now I see that just by copying plot_5 with a new name plot_6 and replacing

plot( plot_1, plot_2, plot_3, plot_4, plot_5, plot_5, layout = lay )

with

plot( plot_1, plot_2, plot_3, plot_4, plot_5, plot_6, layout = lay ),

it works. But IT IS a bug, there is no reason why should not be able to repeat a plot. You are supposed to be able to plot whatever you want, isn't it? And if you think it makes not sense, then at least one should document it. I could think of many situations where the same plot is repeated... for instance, when learning how to arrange several plots together, and you do not worry about what you plot, just want to see the final arrangement. But if you still think it does not make sense what I say (why not?), it doesn't hurt to document the limitations...

Cheers,

Ferran.


On Monday, November 14, 2016 at 2:50:13 PM UTC+1, Tom Breloff wrote:
The behavior is currently undefined if you pass in the same plot twice. Unless there's a compelling reason, I don't think that will change. 

On Monday, November 14, 2016, Scott T <[hidden email]> wrote:
Oh my mistake, I see you have supplied plot_5 twice. If I do that, I get the problem you describe.

I'm not quite sure why you'd want to repeat a plot, but it looks like this is causing problems. If you really want to include plot_5 twice, I suggest making a new plot_6 with the same parameters and including that instead.

I'll open a bug report at Plots for this behaviour.

Scott

On Monday, 14 November 2016 11:59:45 UTC, Scott T wrote:
The layout has space for 6 plots but the final plot command only supplies 5. When I run your example (on the development branch of Plots) I get an error because of that. Have you tried the dev branch? `Pkg.checkout("Plots, "dev")`, restart julia and re-run it.

Scott

On Monday, 14 November 2016 11:29:09 UTC, Ferran Mazzanti wrote:
It is a minor variation of the example given by Scott
for some data set y, cosy, y2, sqrty, siny, logy (doesn't matter the values, could be random)

plot_1 = plot([y cosy],
    title  = "Data y",
    xlims  = (0,10),
    ylims  = (-0.1,1.1),
    grid   = true,
    xlabel = "Iteration",
    ylabel = "y & cos(y)"
);

plot_2 = plot(y2,
    title  = "Data y Squared",
    xlims  = (0,10),
    ylims  = (-0.1,0.5),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2",
    legend = false,
);

plot_3 = plot( [sqrty siny],
title  = "Square Root of y",
    xlims  = (0,10),
    ylims  = (-0.1,0.5),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2"
);

plot_4 = plot(logy,
title  = "Log of y",
    xlims  = (0,10),
    ylims  = (-10,0),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2"
);

plot_5 = plot(expy,
title  = "Exp of y",
    xlims  = (0,10),
    ylims  = (1,2),
    grid   = false,
    xlabel = "Iteration",
    ylabel = "y^2"
);

lay = @layout [a grid(2,2); b]
plot( plot_1, plot_2, plot_3, plot_4, plot_5, plot_5, layout = lay )

Loading...