Hi everyone,

I am needing your help with an issue on ggplot I don't seem to find a solution, I hope you can help me figure it out.

Basically I'm trying to reproduce a H-R diagram that display spectral_class, temperature, luminosity and magnitude. I have all this variables but I don't know the code to display all of them in one plot.

The plot I would like to reproduce is like this one:

The simple answer is that you cannot do this (easily) with ggplo2.

You can add secondary axes, but these must be one-for-one transformations:

I don't know enough about your data to understand whether these transformations are possible.

A more complicated answer is that you can produce any dual-axis plots but that means hacking into the grid system, which requires more advanced expertise.

The base plotting system may be more straightforward for you in this case.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

Hi @martin.R thanks for the quick reply.

I was aware of the suggestion you made but wasn't actually my case since I wanted to plot two numerical variables and two categorical.

I for now dropped the idea to plot multiple axis and just used color for one categorical variable and shapes for the other one. It's not as pleasant as I wished but it did its job anyway.

Btw thanks again for your kind answer!