Please implement geom_GeomXsidebar() and related geoms
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 2.7k
- Forks
- 641
- PR merge metrics
- No merged PRs in 30d
Description
I tried to use plotly on ggplot graph that used geom_xsidehistogram and geom_ysidehistorgram, but when I did I got a warning that plotly was not yet implemented for geom_GeomXsidebar and geom_GeomYsidebar and suggestion to report it here. It would be lovely if plotly were implemented for these geoms.
My data structure was
master - a data frame containing:
- region (character)
- envir_var_elevation (numeric)
- loggdppc (numeric)
- value (numeric)
- reactive_value (numeric)
df_plot - a data frame containing:
- envir.group (numeric factor)
- loggdppc.group (numeric factor)
- value.squish (numeric)
- reactive_value.mean (numeric)
df_plot was created by taking the data from master binning elevation and loggdppc and then finding the mean in each bin combination.
Here is my plot code
p_elev_income = ggplot(df_plot, aes(x = envir.group, y = loggdppc.group, fill = value.squish,
text = glue("reactive adapt: {reactive_value.mean}"))) +
geom_tile() +
geom_xsidehistogram(data = master, aes(x = envir_var_elevation, y = after_stat(density)), binwidth = .01, inherit.aes = F) +
geom_ysidehistogram(data = master, aes(x = after_stat(density), y = loggdppc), binwidth = 0.08, inherit.aes = F) +
ggside(x.pos = "bottom", y.pos = "left") +
xlab(xlab_name) +
ylab("Log GDP per Capita") +
scale_fill_gradientn(colours = blue_red.colors,
name = scale_name,
limits = limits_val,
breaks = breaks_labels_val,
labels = breaks_labels_val,
values = rescale(rescale_val),
na.value = NA
) +
theme(panel.background = element_rect(fill = 'white', colour = 'grey'),
ggside.panel.scale.x = 0.2,
ggside.panel.scale.y = 0.2)
ggplotly(p_elev_income)
Here's what the plot looks like when plotted normally:
And here's what it looks like when plotted with plotly:
I was using plotly because I wanted the hover text/tool tip ability, and that functionality did work correctly for me. Unfortunately, the side histograms disappeared. Also for my use case, I only need the hover text/tool tip on the main geom_tile portion of the graphic having it also appear on the side histograms would just be a bonus.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how ggplotly handles geom_GeomXsidebar and geom_GeomYsidebar, including the geom_xsidehistogram and geom_ysidehistogram entry points. Compare the normal ggplot output with the converted plot and verify that the side histograms render in ggplotly while preserving the existing main geom_tile hover text.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- plotly, r
- Domain
- data-visualization
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100