eliocamp / metR

Tools for Easier Analysis of Meteorological Fields
https://eliocamp.github.io/metR/
142 stars 22 forks source link

Suggestion - add trans option to geom_contour2 and geom_text_counter ? #100

Closed rowlesmr closed 4 years ago

rowlesmr commented 5 years ago

Hi

I don't know if this is the correct place to suggest this, but: Is it possible to add trans option to geom_contour2 and geom_text_counter?

I would like to do something like geom_contour2(aes(z = z), color = "black", alpha=0.5, trans="log10") + geom_text_contour(aes(z = z), trans="log10")

and have sensible contour placement and labels

. I can workaround the contours by geom_contour2(aes(z = log10(z))). Contour labels don't quite work: geom_text_contour(aes(z = log10(z))) - I can't see how to label the contours with their actual values, as opposed to their log10 values.

Mattehw

eliocamp commented 5 years ago

If I understand it correctly, what you want is to have logarithmically separated breaks but with normal labels and values? If that's what you want, then I think that the most direct route would either to pass a vector of breaks to the break parameter or a function that constructs breaks. As a quick fix, you could also use goem_contour_text(aes(z = log(z), label = exp(..level..))) to show labels in the original units.