psrc / psrcplot

Package for Creating PSRC consistent data visualizations with R
https://psrc.github.io/psrcplot/
GNU General Public License v3.0
2 stars 0 forks source link

line chart: labels drop for number datatype on x-axis #66

Closed MrichardsPSRC closed 1 year ago

MrichardsPSRC commented 1 year ago

I'm making a static line chart with dates along the x-axis. I was able to get the years to show along the x-axis. image

I have two minor suggestions:

  1. Add this as a FAQ or something in the documentation about having to make the date field into date format. When I just used 'year' (numeric) instead of the newly created 'year_date', there were no labels along the x-axis
  2. Is there a way to include the labels for all of the years along the x-axis instead of every other? It's likely a spacing concern, but this screenshot is when I expand/show in a new window
# need to make the year column date format
lifeexpec_poc_trend$year_date <- as.Date((as.character(lifeexpec_poc_trend$year)),
                                         format = "%Y")

# creating line chart
line_option <- static_line_chart(t=lifeexpec_poc_trend,
                                 x="year_date", y="health_ind",
                                 fill="quintile_order",
                                 est = "number",
                                 dform = "%Y",
                                 color = "blues_inc",
                                 title = indicator_measure,
                                 subtitle = "People of Color",
                                 source = paste("Sources: Washington Tracking Network, Washington State Department of Health,", "\n", "U.S. Census Bureau, PUMS 1-year, 2015-2020,", "\n", "2020 Census Tracts"))

line_option
jensenmj commented 1 year ago

Solved with commit 43b0e78.