Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibility to add columns #1

Open
xfim opened this issue Jul 11, 2024 · 7 comments
Open

Possibility to add columns #1

xfim opened this issue Jul 11, 2024 · 7 comments

Comments

@xfim
Copy link

xfim commented Jul 11, 2024

Hola Marc,

M'ha encantat poder fer servir aquesta feina teva. Gràcies per posar-ho a disposició de tothom i per contribuir a R.

Obro aquest tema per demanar si seria possible, en l'esperit de la figura d'sparklines que hi ha al principi com a exemple de Tufte, d'afegir una opció que fos "facets" alguna cosa per dir-li que ho vols en 2/3/4 columnes ordenades per, per exemple, el número màxim de la sèrie al final del període. Seria molt útil, ja que ara cal fer-ho manualment.


Dear @marcboschmatas,

Would it be possible to have some sort of "facets" option to allow for 2/3/4 columns, in order to easily replicate Tufte's example that you start with? Thank you.

@marcboschmatas
Copy link
Owner

Ostres Xavier! M'alegro molt que t'hagi servit. Hi penso una mica a veure com ho puc implementar i, si més no, poso una vinyeta que expliqui com fer-ho si no trobo la manera. Curiositat, on ho has aplicat?

@xfim
Copy link
Author

xfim commented Jul 11, 2024

T'ho passo per correu (me'n dones un?). Gràcies per mirar-t'ho. Ja que hi estem posats, el tema de l'arrodoniment no em funciona. Obro un nou issue i ho fem seriosa i formalment?

@marcboschmatas
Copy link
Owner

[email protected]. Si em pots fer un issue per això de l'arrodoniment i m'ho expliques bé, hi miro de fer un cop d'ull. Merci!

@xfim
Copy link
Author

xfim commented Jul 11, 2024

You could add a function like facet_sparklines(~ UnitOfObservation, ncol = 3, order = max) that would allow you to divide the figure in 3 columns by the Unit of observation traced over time, and to also allow the units to be sorted by their maximum value attained during the series.

@marcboschmatas
Copy link
Owner

I wonder if this could be solved just by using facet_wrap and specifying the number of columns instead of facet_grid as proposed in the vignette, or ad a second variable to the facet_grid. Something like this

  stat_interquartilerange(geom = "ribbon",
                          show.legend = FALSE) +
  geom_line() + 
  stat_sparklabels(geom = "point", label_fun = \(x) round(x, 0),
                   show.legend = FALSE) + 
  stat_sparklabels(geom = "text_repel", label_fun = \(x) round(x, 2),
                   show.legend = FALSE) + 
  scale_colour_manual("", values = c("black", "blue", "red")) + 
  scale_y_continuous(limits = c(0, 25)) + 
  facet_wrap(~Month, ncol = 2) +
  ggtitle("Daily wind intensity by month in NYC") +
  theme_minimal() + 
  theme(panel.grid = element_blank(),
        axis.ticks = element_line())```


@xfim
Copy link
Author

xfim commented Jul 11, 2024

Partially. And it is true that Tufte's example in the beginning has the column sorted left-to-right and then down to bottom. But I was wondering if it would be better to see them top-down and then left-to-right. Which requires a different set up from the already existing facet_ functions. I am not sure how Tufte would approach it. If you don't see it, just let it go.

@marcboschmatas
Copy link
Owner

I put it on my to-do list. I don't know if I'll be able to do it as soon as I'd like to but it's definitely on my mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants