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

18 messages
Open this post in threaded view
|
Report Content as Inappropriate

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

 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 plotlay = @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 toplot y and cosy in the first plot, and sqrty and siny on the second plot?Thanks for your help,Ferran.
Open this post in threaded view
|
Report Content as Inappropriate

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

 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,ScottOn 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 plotlay = @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 toplot y and cosy in the first plot, and sqrty and siny on the second plot?Thanks for your help,Ferran.
Open this post in threaded view
|
Report Content as Inappropriate

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

 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: https://gist.github.com/swt30/54701d09cfa479dab78a5bc2fa857fd7Cheers,ScottOn 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 plotlay = @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 toplot y and cosy in the first plot, and sqrty and siny on the second plot?Thanks for your help,Ferran.
Open this post in threaded view
|
Report Content as Inappropriate

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

 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 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,ScottOn 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 plotlay = @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 toplot y and cosy in the first plot, and sqrty and siny on the second plot?Thanks for your help,Ferran.
Open this post in threaded view
|
Report Content as Inappropriate

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

 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.ScottOn 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 <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: https://gist.github.com/swt30/54701d09cfa479dab78a5bc2fa857fd7Cheers,ScottOn 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 plotlay = @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 toplot y and cosy in the first plot, and sqrty and siny on the second plot?Thanks for your help,Ferran.
Open this post in threaded view
|
Report Content as Inappropriate

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

 Even better... you should add a tutorial for how to do: https://github.com/tbreloff/Plots.jl/issues/541On Tue, Nov 8, 2016 at 12:00 PM, Scott T 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.ScottOn 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 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,ScottOn 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 plotlay = @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 toplot y and cosy in the first plot, and sqrty and siny on the second plot?Thanks for your help,Ferran.
Open this post in threaded view
|
Report Content as Inappropriate

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

 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,
Open this post in threaded view
|
Report Content as Inappropriate

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

 "@layout [a grid(2,2); b]" should workOn 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,
Open this post in threaded view
|
Report Content as Inappropriate

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

 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 workOn Friday, November 11, 2016, Ferran Mazzanti <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,
Open this post in threaded view
|
Report Content as Inappropriate

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

 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,PatrickOn 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 workOn 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,
Open this post in threaded view
|
Report Content as Inappropriate

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

 It is a minor variation of the example given by Scottfor 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 )
Open this post in threaded view
|
Report Content as Inappropriate

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

 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.ScottOn Monday, 14 November 2016 11:29:09 UTC, Ferran Mazzanti wrote:It is a minor variation of the example given by Scottfor 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 )
Open this post in threaded view
|
Report Content as Inappropriate

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

 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.ScottOn 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.ScottOn Monday, 14 November 2016 11:29:09 UTC, Ferran Mazzanti wrote:It is a minor variation of the example given by Scottfor 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 )
Open this post in threaded view
|
Report Content as Inappropriate

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

 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.ScottOn 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.ScottOn Monday, 14 November 2016 11:29:09 UTC, Ferran Mazzanti wrote:It is a minor variation of the example given by Scottfor 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 )
Open this post in threaded view
|
Report Content as Inappropriate

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

 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 )withplot( 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 <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.ScottOn 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.ScottOn Monday, 14 November 2016 11:29:09 UTC, Ferran Mazzanti wrote:It is a minor variation of the example given by Scottfor 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 )
Open this post in threaded view
|
Report Content as Inappropriate

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

 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 )withplot( 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.ScottOn 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.ScottOn Monday, 14 November 2016 11:29:09 UTC, Ferran Mazzanti wrote:It is a minor variation of the example given by Scottfor 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 )
Open this post in threaded view
|
Report Content as Inappropriate

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

 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 <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 )withplot( 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.ScottOn 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.ScottOn Monday, 14 November 2016 11:29:09 UTC, Ferran Mazzanti wrote:It is a minor variation of the example given by Scottfor 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 )