4

Drawing using code below

p = scatter(; title = "a", titlefont=font(12), 
            xlabel = "message size",
xscale = :log10, xlims, xticks, ylabel = "time [sec]",
ylims, yscale = :log10, legend=:outertopright, 
    left_margin=15Plots.mm, bottom_margin=15Plots.mm,
guidefont=font(8), xtickfont=font(5), 
   width=2000,height=2000, legend_margin=5, 
   legendfont=font(5))

scatter!( p, data1[:, 1],  data2[:, 5], 
       color=colors[index], ma=0.9   )

plot by code  above

The legends is going outside of the plot. How to avoid it or increase the size of whole graph.

data1 = [0,4,8,16, ,32 ,64 ,128 ,256 ,512 ,1024 ,2048 ,4096 ,8192 ,16384 ,32768 ,65536 ,131072 ,262144 ,524288 ,1048576 ,2097152 ,4194304]

data2=[3.08E-06 ,6.20E-06 ,6.26E-06 ,3.75E-05 ,4.36E-05 ,4.37E-05 ,4.52E-05 ,4.70E-05 ,5.58E-05 ,5.83E-05 ,6.67E-05 ,8.77E-05 ,0.000134397 ,0.000229329 ,0.000424682 ,0.000868432 ,0.00035778 ,0.000452593 ,0.000561347 ,0.000750234 ,0.001281027 ,0.002102504]
kjetil b halvorsen
  • 1,206
  • 2
  • 18
  • 28
Khalid Bin Huda
  • 1,583
  • 17
  • 16
  • 1
    How is it possible to put 114 legends on a figure that size? – AboAmmar Jan 29 '23 at 15:34
  • @AboAmmar I also tried to increase the length and width (width=3000,height=3000) but its not working. – Khalid Bin Huda Jan 29 '23 at 15:56
  • from a presentation angle, I don't think it's a good idea to make a plot like this to begin with, even if you can make the bottom white space go larger – jling Jan 29 '23 at 16:22
  • Why list the Y values as a legend on the plot? Make a table for that, and plot some kind of summary or histogram instead. – Bill Jan 30 '23 at 22:45
  • it looks like you only have 5(?) distinct colors, so at most you should only have 5 distinct legend entries. If you need help with doing that let me know and I'm happy to show you an example of how you could do that with your `index` variable (which looks to me to be assigning the colors and thus should also assign the labels). – kirklong Jan 31 '23 at 17:27
  • 1
    This is an easy trap to fall into. `plots` arguments are sensitive to the shape of the input (e.g. vector vs. row matrix). And I suspect the OP is trying to address what he saw as "every point that should be in the same series is a different color" just by specifying the colors. So Khalid, what are the elements of `data1` and `data2`? – Nick Bauer Feb 02 '23 at 21:51
  • @NickBauer I have updated the data set in the question. – Khalid Bin Huda Feb 02 '23 at 22:04
  • 1
    @KhalidBinHuda - With that data you posted, I'm not getting what you see. What does reproduce it is, for instance, `scatter(data1', data2', xscale = :log10, yscale = :log10, color = [:blue :red])`. It's best to run all the code you posted fresh to make sure the example is working. – Nick Bauer Feb 03 '23 at 23:23
  • Good point Nick. That answer is also here: https://stackoverflow.com/questions/56017562/plot-along-different-dimensions – Bill Feb 06 '23 at 22:45

0 Answers0