R ggplot2 geom_boxplot horizontal bars - r

I am very new to R and I wanted to use a box and whisker chart in my power bi dashboard and the custom visualisation for this was very slow for the volume of data.
I got the same data I am using in power bi from a mssql 2012 database and tried the same code in R studio. I get the box and whisker chart but all I get is horizontal bars. I am using the below code. SecondsOpen is still a num in the data frame as I had read this can get set to factor.
When I calculate median and average and percentiles via functions in power bi it all works ok. I am clearly doing something wrong but as I am so new to R I am struggling to see what.
library(ggplot2)
ggplot(res,aes(month_start_date,'SecondsOpen')) +geom_boxplot()
Box and whisker Image
Dataframe Datatypes Image

ah it was 'SecondsOpen' should be SecondsOpen!

Related

Plotly by Akevelon boxplot does not give the same result as boxplot in r

I think I have found a possible bug in Plotly by Akevelon of Power bi. The thing is that I have made a boxplot in power bi using the component I mentioned above and I get very different metrics than if I do it with rstudio using the plotly package.
The boxplot I tried to make contains on the x=type and y=publication axis of the following dataset: https://www.kaggle.com/datasets/aneesayoub/world-universities-ranking-2022?resource=download
This are the results I get by using plotly on power bi
This are the results I get by using plotly on Rstudio
The code I used in R is the following:
library(ggplot2)
library(plotly)
pl=ggplot(my_data,aes(x=type,y=publication))+geom_boxplot(outlier.shape = NA)
ggplotly(pl)
Any idea of what is the problem?
I tried by using Python and I get the same results as R boxplot

Can I create a target zone on my time series plots in R?

I've created a time series plot in R using the ggplot package, but I wanted to see if I could further customize it by creating target zones. I originally started with an Excel plot that allows me to move a gray box to different areas of the plot as an easier way to point out a range of temperatures. However, I wanted to see if I could replicate this in R. Here's a screenshot of my Excel plot to better explain my goal: Time Series on Excel. On the time series plot, you can see a gray box that you can drag around and change the size of to better define a range of temperatures (in this case, it covers from 15-25C). Is this possible to do on top of my time series plot in R? I'm only starting to code in R so it's been quite hard for me to navigate, and I appreciate any help I could get. Thanks!

Overlay Plots : Time Series - Different Frequencies (Lines over Bars) [ggplot2]

My question is about overlaying plots of different x and y scales .The raw data is out of a public weather database in New Zealand called CliFlo, managed by NIWA. I'm not prepared to copy the data for an example because of copyright protections.
I want to reproduce the types of graphs they offer at a fee, shown on this web page. Take the Rainfall graph. There is a cumulative rainfall line graph overlayed on top of a monthly rainfall bar graph. I can generate each graph separately using ggplot2, but I can't find a good way to overlay them like in the example. I've found the gridExtra package to let me print them side-by-side, and I've come across the magick package that might let me do the job, but I'm not sure on how to get the plots lined up properly and how to use the magick package properly. Can anybody help me out on this?
Should I try to scale the month bars to fit the daily line graph but make them spaced out and thicker so they look like months, or would it be easier to use the magick package somehow?
I'd attach an image of what I have so far, but I'm new to this website and it won't let me yet.

R: getting data (instead of plot) back from sm.density.compare

I'm doing a density compare in R using the sm package (sm.density.compare). Is there anyway I can get a mathematical description of the graph or at least a table with number of points rather than a plot back? I would like to plot the resulting graphs in a different application, but need the data to do so.
Thanks a lot for the help,
culicidae

Plotting vertical bars and series (x= y=) together using SAS

Here is a graphical output that I'm trying to mimic. I want a series AND vertical bars plotted simultaneously
However the SAS has a compatibility issue with plotting series and vbar together. Is there a way to plot my data as above?
Take a look at the V9.2 GBarLine example at:
http://robslink.com/SAS/democd30/aaaindex.htm
If you have SAS version 9.2 or above you should be fine.

Resources