[R] ggplot2 - specific y axis scale for each time series in facet grind
Maxim Fomin
mxfomin at gmail.com
Thu Jan 21 20:35:23 CET 2016
Thanks, that worked.
Best regards,
Maxim
2016-01-21 22:29 GMT+03:00 Ulrik Stervbo <ulrik.stervbo at gmail.com>:
>
> You can try facet_grid(variable~., scales = "free_y")
>
> On Thu, 21 Jan 2016 at 19:29 Maxim Fomin <mxfomin at gmail.com> wrote:
>>
>> Dear R users,
>>
>> I have a (melted) data frame of several metal prices from 1980. I want to
>> make a time series plot for each metal price. By default ggplot constructs
>> single plot for all prices. Adding +facet_grid(variable~.) makes for each
>> metal price a plot, but now there is another problem - scale of y axis.
>> Some metals have price $1000 and some $2. Because ggplot makes same y scale
>> for each metal, some metal prices printed as straight horizontal line. What
>> is the command to make for each plot specific y axis scale?
>>
>> Currently I am trying command:
>>
>> ggplot(data=melted2, aes(x=date, y=value, group=variable,
>> color=variable))+geom_line()+facet_grid(variable~.)
>>
>>
>> Best regards,
>> Maxim
>>
More information about the R-help
mailing list