Closed
Description
Hello,
I'm new to Plotly and am very excited to use it's flash visualizations and the tooltip. I'm running into an issue with my x & y labels getting cut off when I run the viz with ggplotly -- whereas it works fine when I just run the ggplot().
Below is the code and viz. I appreciate the help in advance!
Andrew
Here's my code:
testPlot <-
ggplot(TopCarePaths.Req,aes(x = calc_appears_offset, y = total.completed_sum/total.completed_and_expired_sum ) )+
geom_point( aes( shape = is_form, color = PrePostFlag, text = paste("Title:", title_full) ), alpha = 2/5, size = 5) + #dimensions of CarePath
# geom_point( aes( text = paste("Title:", title_full) ) ) + # changes the tooltip
# geom_rug(sides="b", position='jitter') + #adds rug, which counts number of points. Added so only applied to X-axis & spread out with jitter
guides( alpha = FALSE ) + #hides unneccssary legend for hard coded transparancy
facet_grid( organization_parent_name~. ) + #Facets graph horizontally
scale_x_continuous( limits = c( -50, 50 ), breaks = seq( -50, 50, 5 ) ) + #controls X axis tick marks
scale_y_continuous(labels = scales::percent) + #quickly changes y axis to %
geom_vline( xintercept = 0 ) + #adds solid line to chart
geom_text( aes( x = 0, label = "Surgery\n", y = .2), family = 'sans', angle=0, color = 'gray34', size = 3, alpha = 1/5 ) + #puts text next to line for surg date
theme_bw() + #changes to a simpler, easy to read theme
theme( strip.background = element_blank() ) + #removes ugly gray from name area of facet
ggtitle( 'Content Completion by Across Full CarePath' ) +
ylab('Completion %') +
xlab( 'Days Appears Offset from Surgery' )
ggplotly()