Comments (1)
Hi,
Glad you find it useful. No magic bullet for this. Don't know if you've looked at the relevant vignette where I write this:
Finally, let me take a moment about crowding and labeling. I’ve made every effort to try and deconflict the labels on the left and right axis (in this example the Country) and that should work automatically as you resize your plot dimensions. ** pro tip - if you use RStudio you can press the zoom icon and then use the rescaling of the window to see best choices **.
But the numbers (GDP) are a different matter and there’s no easy way to ensure separation in a case like this data. There’s a decent total spread from 57.4 to 20.7 and some really close measurements like France, Belgium, and Germany on the right side. My suggestion is in a case like this one you create a new column in your dataframe with two significant places. So specifically it would be newgdp$rGDP <- signif(newgdp$GDP, 2). In my testing, at least, I’ve found this helps without creating inaccuracy and not causing you to try and “stretch” vertically to disambiguate the numbers. This time I’ll also use LineColor to highlight how Canada, Finland and Belgium fare from 1970 to 1979.
So after a quick look at the pdf file you enclosed. You could:
- Change the overall dimensions of the plot to make it taller and less wide (that's what've done in rmd file for the vignette.
- You can try my rounding trick as described in the vignette
- Go to the top 10 or 15 themes or make it two pages (the bottom ones will spread out as you remove the top.
- I recently added a new
Data.label | an optional column inside the dataframe that will be used as the label for the data points plotted. Can be complex strings and have
NAvalues but must be of class
chr. By default
Measurementis converted to
chrand used.
so for example for all those items under 4.0% you could create a custom label that was "<4%"
Some easy examples of how to use it
newcancer$datalabel <- paste0(newcancer$Survival, "%")
newggslopegraph(newcancer, Year, Survival, Type, Data.label = datalabel)
newcancer <-
newcancer %>%
mutate(datalabel = case_when(Survival <= 4 ~ "< 4.0%",
TRUE ~ paste0(Survival, "%")))
newggslopegraph(newcancer, Year, Survival, Type, Data.label = datalabel)
from cgpfunctions.
Related Issues (20)
- Is there a way to change the Label Color? HOT 2
- Save PlotXTabs output HOT 1
- newggslopegraph: line color based on change over time/slope? HOT 1
- The method to evaluate if dataframe exists only checks if it exists in Global Environment. HOT 2
- Typo variablename in vignette HOT 4
- Code breaking with upcoming ggplot2 3.3.1 release HOT 1
- CGPfunctions HOT 14
- Chang linetype based on a grouping factor HOT 2
- formatting numbers in newggslopegraph HOT 4
- Compatibility with Pipes (%>%) HOT 2
- Deprecation of sjstats::anova_stats() HOT 6
- Complete cases in chaid_table HOT 2
- cran install fails on R 4.0.5
- Grouping error: double observation on y-axis
- Delete lines between data.lable and y.text?
- Save plot2WayANOVA as an object
- R package CGP functions library load error HOT 3
- Include a better dataset with the package? HOT 1
- Is there a way to reverse the y-axis? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cgpfunctions.