IDEMSInternational / R-Instat

A statistics software package powered by R
http://r-instat.org/
GNU General Public License v3.0
38 stars 102 forks source link

PICSA graphs caption position problem #5489

Open rdstern opened 5 years ago

rdstern commented 5 years ago

I did a simple PICSA graph for data from Dodoma. I added a sub-title and caption using the sub-dialogue

I then wanted to change their position to centre them. This may be useful enough that it could be included in the PICSA dialogue in the future. It is the hjust argument. Currently it is available from the Plot Options > Themes > Full options. If you change the default of 0 to 0.5 it is centred.

In the PICSA graphs it gives the following (long!) error message.

_Error running R command(s) Error in grid.Call.graphics(C_rect, x$x, x$y, x$width, x$height, resolveHJust(x$just, : invalid color name '' The error occurred in attempting to run the following R command(s): Dodoma18c_by_Name_s_year <- data_book$get_data_frame(data_name="Dodoma18c_by_Name_s_year") last_graph <- ggplot2::ggplot(data=Dodoma18c_by_Name_s_year, mapping=ggplot2::aes(x=s_year, y=as.numeric(x=sum_rain))) + ggplot2::geom_line(colour="blue", size=0.8) + ggplot2::geom_point(size=3, colour="red") + theme_grey() + ggplot2::theme(panel.background=ggplot2::element_rect(colour="white", fill="white", size=0.5, linetype="solid"), panel.grid.major=ggplot2::element_line(colour="lightblue", linetype="longdash", size=1), panel.grid.minor=ggplot2::element_line(colour="lightblue", linetype="longdash", size=1), panel.border=ggplot2::element_rect(colour="black", fill="", size=0), axis.text.x=ggplot2::element_text(angle=90, vjust=0.4, size=12), axis.title.x=ggplot2::element_text(size=14), axis.text.y=ggplot2::element_text(size=12), axis.title.y=ggplot2::element_text(size=14), title=ggplot2::element_text(size=20), plot.subtitle=ggplot2::element_text(hjust=0.50), plot.caption=ggplot2::element_text(hjust=0.50)) + ggplot2::xlab(label="") + ggplot2::ylab(label="") + ggplot2::labs(title="", subtitle="here is a title", caption="here is a caption") data_book$add_graph(graph_name="last_graph", graph=last_graph, data_name="Dodoma18c_by_Name_s_year") data_book$get_graphs(data_name="Dodoma18c_by_Name_s_year", graph_name="lastgraph") OK

I tried a simple version of the same plot using the ordinary plotting dialogues. There the change of caption and sub-title position works fine.

I then wondered if the issue was one of using the ordinary plot options. I started again and used the ordinary plot options to change the point colour to blue (hooray you can do that, even though it is on the main dialogue) and that worked fine.

rdstern commented 3 years ago

There is another problem I find with the dialogue. When set for dates for y axis it insists on always setting the lower limit again.