Genie Discord forum

Author Avataritzi
3/1/2023, 5:16:34 PM


I am trying to create a plot with subplots and I can not find an example for it, I have tried the syntax of the StipplePlotly demos and played a bit around but I can not make it work.

Can anyone help me find it?

Thank you!

Author Avatarabhimanyuaryan
3/4/2023, 3:41:41 PM

@itzi for subplots you have to pass custom layout as I can see from examples:

var trace1 = {
  x: [1, 2, 3],
  y: [4, 5, 6],
  type: 'scatter'

var trace2 = {
  x: [20, 30, 40],
  y: [50, 60, 70],
  xaxis: 'x2',
  yaxis: 'y2',
  type: 'scatter'

var data = [trace1, trace2];

var layout = {
  grid: {rows: 1, columns: 2, pattern: 'independent'},

Plotly.newPlot('myDiv', data, layout);


Author Avataritzi
3/6/2023, 8:58:11 AM

Hi! thanks for the reply, I have also seen this,, how can I translate this to GenieBuilder syntax? Thank you!

Author Avatarabhimanyuaryan
3/6/2023, 1:47:05 PM

ok I need to test that. I haven't tried it. Will post solution later

Author Avatarhhaensel
3/7/2023, 11:40:18 PM

If you work with PlotlyBase, you can group plots by hvcat syntax: [p1 p2] or [p1; p2]

Author Avatarhhaensel
3/7/2023, 11:41:20 PM

You can even do myplot = [p1 p2; p3] if myplot is a reactive model field.

Author Avataritzi
3/8/2023, 10:52:02 AM

Do you know what is the syntax in the PlotLayout if i want to make the y axis logarithmic? I can not find any examples or documentation

i tried PlotLayout(showlegend = true, yaxis =:log) or yaxis="log" and so but it does not work

thank you!

Author Avatarabhimanyuaryan
3/8/2023, 1:08:29 PM

@itzi are you using PlotlyBase or StipplePlotly's struct base syntax?

Author Avataritzi
3/9/2023, 12:23:32 PM

hi! i am using the syntax suggested in the example in Pere's article :

And I am trying to use Stipple to understand the syntax (is it possible that there were plot examples and they are not there anymore?) but i am clearly not understanding how to use it..

Author Avataritzi
3/9/2023, 12:31:47 PM

I have my PlotData array that works well and if i implement the examples he gives of PlotLayout it works too, I am just struggling to add a logarithmic axis in PlotLayout - i am trying to use this too but i really can not find it

  (and subplots too, but until that is solved i can just rearrange the GUI)
Author Avatarhhaensel
3/12/2023, 12:57:40 AM

It's PlotLayout(yaxis = [PlotLayoutAxis(type = "log")])

Author Avataritzi
3/13/2023, 1:26:04 PM

i am not sure what is happening because no matter if I type xaxis or yaxis it just makes the x axis logarithmic, and if I apply it to both still it just works on x

Author Avatarhhaensel
3/15/2023, 11:56:57 AM

you have to add a `xy = "y"`` in the PlotLayoutAxis,

PlotLayout(yaxis = [PlotLayoutAxis(type = "log", xy = "y")])
Author Avatarhhaensel
3/15/2023, 11:58:10 AM

The interface is a bit strange here, it would work to put x and y axis in the array and assign it to one of xaxis or yaxis

Author Avatarhhaensel
3/15/2023, 11:58:42 AM

default is "xy" = "x" that's why you never changed the yaxis

Author Avatarhhaensel
3/15/2023, 11:59:05 AM

@essenciary Maybe, we have a look at it?

Author Avatarhhaensel
3/15/2023, 11:59:45 AM

Or we rename the attribute name to axes

Author Avatarhhaensel
3/15/2023, 12:00:16 PM

then it's clear that we have to define it

Author Avataritzi
3/15/2023, 4:28:12 PM

thank you! you guys are doing a great job ๐Ÿ˜Š by the way, I still do not know how to implement this in GenieBuilder, at the moment I am just creating more plots in the GUI as a workaround