dreamRs / esquisse

RStudio add-in to make plots interactively with ggplot2
https://dreamrs.github.io/esquisse
Other
1.76k stars 227 forks source link

Sort barchart columns [Feature Request] #231

Open DanielPascoe opened 1 year ago

DanielPascoe commented 1 year ago

Default sort order for bar charts seems to be the order of the categorical column. Therefore if you have a data frame whose categorical data is in alphabetical order, the Y axis variable is unlikely to plot in descending (or ascending) numerical order.

Option to sort by a numeric value - general use case would be the numeric value of the column plotted in the bar chart Y axis, although sort on another column would also be a nice to have.

_edit - something like + scale_x_discrete(limits = myvar) I presume is a straightforward syntax here

mjwebster commented 1 year ago

I would also like this feature!

pvictor commented 1 month ago

Hello,

In last CRAN release of esquisse (v2.0.0) you can open a tool to reorder factor's levels via a button in the toolbar:

Click the "Update factor" button in the header :

esquisse-btn-reorderlevels

In the popup window you can rearrange levels by alphabetical or count order or drag and drop individual levels :

esquisse-update-levels

Then click "Update factor variable" button at the bottom of the window and the plot will update with new order :

esquisse-reordered

Victor