I'm trying to plot out horizontal bar graphs for different districts/counties, where the x-axis represents a value (count) and the y-axis represents the name of each district/county. On Shiny, I have a reactive component that filters a CSV file with this data and a drop-down to select which state/county to plot. The box function is from bs4Dash
I'm using the div element to create a horizontal and vertical scroll bar if the y-axis elements exceed the max-height, which works well. On the server.r side, using the standard ggplot2 and plotly combo with renderPlotly to filter the CSV based on user select and plot a barchart.
The first chart shows 3 counties with each bar taking up maximum space to cover the chart area, with default aesthetics. The second chart shows over 70 counties.
So here ,would it be possible to force the size of the bar graph to be constant across all values of y? I think the underlying method is to make the bar take up space on the chart area based on the number of y-values, would it be possible to force the bars to the same size regardless of y being 3 or 70?
you can set the bar width to be particular fraction, so for relatively sized charts you can make the smaller charts bar width relatively smaller to match that of the bigger chart.
Thanks so much @nirgrahamuk ! This is an interesting solution. I don't mean to be a bother, but would you be able to recreate this with a sample categorical data linked here?