Why is the y axis label horizontal

For weeks this worked. I haven’t touched the plot function. Suddenly, the y axis label is horizontal instead of vertical. guidefontrotation changes both the x axis and y axis labels. So, that won’t work.

Yes, I added PlotThemes (like it a lot) and for the first few days the y axis label was vertical.

Not sure what happened or how to get it back.


Plot code:

function cumplot(dseries, locale, plseries=[:Unexposed,:Infectious,:Recovered, :Dead];

    theme(:ggplot2, foreground_color_border =:black, reuse = false)

    !(typeof(plseries) <: Array) && (plseries = [plseries])

    # the data
    n = size(dseries[locale][:cum],1)
    cumseries = Matrix([DataFrame(Day = 1:n) dseries[locale][:cum][!,plseries]])
    labels = string.(plseries)
    labels = reshape([labels...], 1, length(labels))
    people = dseries[locale][:cum][1,:Unexposed] + dseries[locale][:cum][1,:Infectious]
    cityname = !isempty(geo) ? geo[locale, city] : ""
    died = dseries[locale][:cum][end,:Dead]
    infected = dseries[locale][:cum][1,:Unexposed] - dseries[locale][:cum][end,:Unexposed]
    firstseries = plseries[1]
    half_yscale = floor(Int, maximum(dseries[locale][:cum][!,firstseries]) * 0.5)

    # the plot
    plot(   cumseries[:,1], cumseries[:,2:end], 
            size = (700,500),
            label = labels, 
            title = "Covid for $people people in $cityname over $n days\nActive Cases for Each Day",
            xlabel = "Simulation Days",
            ylabel = "People",
            legendfontsize = 10,
            reuse = false
    annotate!((6,half_yscale,Plots.text("Died: $died\nInfected: $infected", 10, :left)))

How it is now:

How it used to be:

Works as expected with the gr background. All I did was change pyplot() to gr() so I think the Plots code should produce the intended result (very open to any suggestions, though).

But, gr won’t allow the reuse=false option. As of December 2019 there was no plan to implement this. I want to be able to produce a 2-4 plots and keep them open for comparison.

PlotlyJS scares me with all its many dependencies.

Just updated Plots. It’s fixed!

I have something very cool I did with plots that I’ll post. Everyone needs a “hey look how great this worked” post everyone once in a while. I will post it tomorrow.

1 Like

To rotate only either x or y, the keyword is xrotation / yrotation

Guess I need to use plotattr() to see everything as the doc doesn’t always keep up.