Multiple axis in Plots Recipes

#1
@userplot pho
@recipe function f(h::pho)
              legend --> false
             yflip := true
            xmirror := true
              x, y, a, b =h.args
        
    @series begin
        seriestype := :scatter
        seriescolor --> :red
        x , y
    end
  
        @series begin
        seriestype := :path
        seriescolor --> :blue
        subplot := 1
        a , b
    end
    

       end

pho(1:5, 5:9,10:15, 50:55, legend=true, color= :blue)

Captura

How to set multiple x and y axis in recipes plot? Is the keyword twinx / twiny useful here?.

How to set only one series attributes like series color in the input arguments? when put color := :blue both series are set to blue

thanks

0 Likes

#2

How to set multiple x and y axis in recipes plot?

You must create subplots. Here is a link to a tutorial in the documentation:
http://docs.juliaplots.org/latest/tutorial/#combining-multiple-plots-as-subplots

Is the keyword twinx / twiny useful here?.

No. twinx / twiny are there to tie axes from two different subplots together (make them the same).

In the case above, it appears you want different subplots because your datasets are in different portions of the x-y space… and you wish to “zoom in” on each independently (for BOTH x AND y coordinates).

This is the complete opposite case of when to use twinx/twiny: You want to use twinx/twiny when you want to maintain either the same x or y values for both subplots.

How to set only one series attributes like series color in the input arguments? when put color := :blue both series are set to blue

I am not an expert with plot recipes. However, I have never seen the --> operator in Julia. Everything seems fine to me if I replace seriescolor --> with seriescolor := in the code above.

0 Likes