Comments (6)
I've gotten this starting to work in caee020. When a stroke
aesthetic is supplied, instead of rendering just a pictureGrob
, I instead render a gTree
that contains the pictureGrob
and a pointsGrob
of shape 21 (a ring). Because they make up a single geom, this should work with jitters (though I haven't tested it yet) (confirmed).
However, there are some problems:
- Outline sizes aren't calculated properly, so they don't stay on the flag edges. I'm basing the sizing on solitary geom_points, but I don't understand it too well. I'm also worried that size may be scaling to radius rather than area, as it should (I'm not sure if the size values given to the geom are scaled to area beforehand).
-
Colours are totally messed up (see below), and it seems like they 'stick' if i draw a new plot with modified data. I'm guessing this is a scope problem: variables getting created and hanging around after the draw instead of being cleared. Not too sure.
Example:
> df = data_frame(x = 1:4, y = 4:1, siz = c(1,2,1,2), count = c('au', 'us', 'gb', 'de'), colo = c('black','red', 'green', 'blue'))
> df
# A tibble: 4 x 5
x y siz count colo
<int> <int> <dbl> <chr> <chr>
1 1 4 1 au black
2 2 3 2 us red
3 3 2 1 gb green
4 4 1 2 de blue
> ggplot(df) +
geom_flag(aes(x = x, y = y, size = siz, country = count, colour = colo), stroke = 3) +
scale_size(range = c(5, 10))
from ggflags.
Stroke colours render correctly when supplied statically (ie. not as aesthetics). But they're incorrect when supplied as aesthetics (whether as keywords, like "red"
, or as hexcodes, like "#ff0000"
).
from ggflags.
Well, I clearly need my sleep: I totally forgot that when you supply an expression to the colour
aesthetic, the unique values of that expression aren't actually used as colour arguments (the unique values are just used to group the geoms).
The above example needed:
+ scale_colour_manual(
values = c(
'black = 'black',
'red' = 'red',
'green' = 'green',
'blue' = 'blue'))
Yep. Time for bed.
from ggflags.
Was this ever implemented? I can't make it work
from ggflags.
It wasn't, I'm afraid!
from ggflags.
Actually, I believe my progress on this is on the feature-outlines
branch. So if you install that branch using devtools, you might have some luck! I don't rememberif I ever finished it, though 😭
from ggflags.
Related Issues (20)
- Failed download error HOT 13
- More informative text needed when a country isn't recognised
- Contribute to ggflags projects HOT 1
- Supporting R version 3.6 HOT 3
- package ‘ggflags’ is not available (for R version 3.6.2) HOT 5
- The flag of Qatar is purple but should be maroon? HOT 4
- Country code for St Martin "mf" is missing HOT 1
- Switch to HatScripts/circle-flags HOT 17
- Option of PNG support instead of SVG
- Integration with ggiraph
- Package ‘ggflags’ is not available (for R version 4.0.2) HOT 1
- Compatibility with R 4.2 HOT 16
- "wrong" hue of blue for France and the Netherlands HOT 2
- Flags are rectangular, not circular HOT 2
- Is there a flag for Kosovo? HOT 2
- Several errors when attempting to integrate with other packages HOT 5
- Kyrgyz Republic Flag HOT 2
- International/Multinational flag HOT 4
- Feature request: Add possibility for custom country categories HOT 1
- Feature request: Add option to customizer (e.g., capitalize) country names on legend
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 ggflags.