Unable to see x axis labels completely
Open
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 2.7k
- Forks
- 641
- PR merge metrics
- No merged PRs in 30d
Description
Unable to show all the months , Its skipping one month after the other, the months are present but not visible until you zoom in.
What needs to be done here
` output$TP1 <- renderPlotly({
df_plot <- filtered_data()
# Ensure the 'date' column is of Date type
df_plot$date <- as.Date(df_plot$date)
# Set font size
base_size <- 15
# Custom label function to split month and year onto separate lines
library(scales)
custom_date_label <- function(x) {
format(x, "%b\n%Y")
}
# Plot 1: Month vs Interest Coverage Ratio
plot1 <- ggplot(df_plot, aes(x = date, y = interest_coverage_ratio_ttm, group = 1)) +
geom_line(color = "red", size = 1) +
labs(title = "Month vs Interest Coverage Ratio", x = "Date", y = "Interest Coverage Ratio") +
theme_minimal(base_size = base_size) +
theme(
axis.text.x = element_text(size = 8, angle = 0, hjust = 0.5), # Reduce size of x-axis labels
panel.spacing = unit(2, "lines")
) +
scale_x_date(labels = custom_date_label, date_breaks = "1 month") # Custom label formatting
# Convert ggplot objects to plotly objects for interactive tooltips
ggplotly(plot1, dynamicTicks = TRUE) %>%
layout(
xaxis = list(
tickformat = "%b\n%Y" # Format the tooltips as month and year on separate lines
)
)
})`
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
Reproduce the report using the supplied renderPlotly example, focusing on ggplotly(plot1) and the layout xaxis settings. Check how scale_x_date(date_breaks = "1 month") and dynamicTicks affect the rendered x-axis labels. Done means the intended month labels are visible at normal zoom while the interactive chart remains usable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100