# What if we have one type recipe for the x-axis and one for the y-axis?

**URL:** <https://discourse.julialang.org/t/what-if-we-have-one-type-recipe-for-the-x-axis-and-one-for-the-y-axis/93563>\
**Category:** General Usage\
**Tags:** plotting, plots, recipe\
**Created:** [January 26, 2023, 9:22am UTC](https://discourse.julialang.org/t/what-if-we-have-one-type-recipe-for-the-x-axis-and-one-for-the-y-axis/93563 "2023-01-26T09:22:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![singularitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/singularitti/32/17678_2.png) [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Post date:** [January 26, 2023, 9:22am UTC](https://discourse.julialang.org/t/what-if-we-have-one-type-recipe-for-the-x-axis-and-one-for-the-y-axis/93563/1 "2023-01-26T09:22:10Z")

</div>

If we define a type recipe for `MyWrapper` which is the independent variable (x) and one type recipe for `MyOtherWrapper` which is the dependent variable (y). It seems that the plot attributes defined in `MyWrapper` are preferred. Why is that?

```julia
struct MyWrapper
    v::Vector
end
struct MyOtherWrapper
    w::Vector
end

@recipe function f(::Type{MyWrapper}, mw::MyWrapper)
    seriestype --> :path
    markershape --> :circle
    markersize --> 2
    markerstrokewidth --> 2
    return mw.v
end
@recipe function f(::Type{MyOtherWrapper}, mow::MyOtherWrapper)
    seriestype --> :path
    markershape --> :star
    markersize --> 3
    markerstrokewidth --> 1
    return mow.w
end

```

```julia
julia> x = MyWrapper(cumsum(rand(10)));

julia> y = MyOtherWrapper(rand(10));

julia> plot(x, y)

```

 ![IXf9oK3T_000004](https://global.discourse-cdn.com/julialang/original/3X/c/9/c94570c3447f0b2973f4858c2da79419a9f4c417.jpeg)

---

<div class="post-metadata">

**Author:** ![singularitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/singularitti/32/17678_2.png) [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Post date:** [August 31, 2023, 9:26pm UTC](https://discourse.julialang.org/t/what-if-we-have-one-type-recipe-for-the-x-axis-and-one-for-the-y-axis/93563/3 "2023-08-31T21:26:17Z")

</div>

See the example:

```julia
plot(MyWrapper(vals), MyOtherWrapper(times))

```

[here](https://docs.juliaplots.org/stable/RecipesBase/types/#Type-Recipes-2).

Implemented [here](https://github.com/MineralsCloud/EquationOfStateRecipes.jl/blob/9a87548a1a217bbbfbdab230f0d4272cc34dece0/src/EquationOfStateRecipes.jl#L28-L59)  
where `Volumes` is x-axis, and `Energies`, etc., are y-axes.
