Removing grid lines in a map and smoothing in maps - dictionary

I am trying to remove the grids on my map. I used several commands for example: plt.grid(), plt.rcParams["axes.grid"] = False but nothing happens, the map produced as is with the grids. Is there any possible way to remove the grids?
Another thing also, how can I make my plot to be smoothed instead of having the data as blocks (see below a sample of the plot).
enter image description here
Please assist in this regard.
Truly appreciate your time.
Thank you.

Related

Momocs default PCA remove coloured boxes behind points

A R / Momocs learner here.
Currently I'm creating a PCA with some leaf shapes (20+ different populations).
I have created the harmonics and now applying the default (?) PCA graphic:
lo.f <- efourier(lo, 12)e
lo.p <- PCA(lo.f, fac=pop)
plot(lo.p, ~pop)
This produces the default PCA graphic (dots with coloured boxes behind), but the code itself for the graphic is hidden.
I'd like to remove the coloured boxes behind each population (and replace them with something else). It's just too busy with 20+ boxes.
Is it possible to know please where to view the code for the default PCA and remove the coloured boxes bounding each population?
Thanks and apologies such a basic question I am a learner.
M
Thanks all, a Momocs authors got back to me.
Basically the answer was instead of using the standard PCA command (listed above in the question) you can apply instead another command- plot_PCA(lo.p, ~pop, chull=FALSE)
The useful part in my situation being chull=FALSE part, which removed the background shading. There are a number of other options the author advised me to assit in "tweaking' the graphics which I'm currently playing around with.
Thanks all
Michael

plot panel visualization using ggplot2 in R shiny

I am implementing a R shiny with a plot panel implemented by library(ggplot2). If there are 12 plots, the layout looks great. Please check below.
12-plot layout
However, if I increase the plot number to 70, then each plot looks being compressed (pls see below). Is that possible I can keep the size of each plot fixed? Thank you so much!
enter image description here
Is there another way to approach this? For instance, can you group your data by two categorical variables and use on for colouring and the other for facetting? In that way, you may be able to reduce the number of facets, and stick with the larger facet size, while still conveying all relevant information? 70 facet plots is a lot!
Is this more of a QC thing? For QC, I tend to break it into groups by condition as Paul was suggesting. The reason is that within a condition, things should be really similar. Outside a condition, all bets are off. When I do this for genomics data, I tend to use “pairs” customized to my liking.
What don’t you like about the 70 sample display? Simply the change in aspect ratio? IMO, these are the things I don’t like about ggplot. You can make these plots using base R and then place them on a page manually using par or layout. For that matter, you can do the same with ggplot and use ggarrange or a different manual layout function to place the plots. All wrapped in a for or apply of course.
The other things I like to do when I have a LOT of QCs to look through is create a movie. I can use the forward/back buttons and go through a lot quickly. I like the idea of having this in a dashboard, nice one!
you could also try coord_fixed(ratio= ), not sure if that will work with faceting or not
Finally, I have made a movie-like visualization for those 70 plots using the plot_ly function in R package "plotly".

Creating a grid on a map in R using grid points

I'm clearly struggling with this problem for a day now and can't seem to find a nice solution to it. I would really appreciate some help and I'm really a novice in R (since last week).
Problem 1:
I have a set CSV representing grid points which I can parse into a data frame (pointname, latitude, longitude).
Eg:
name,latitude,longitude
x0y0,35.9767,-122.605
x1y0,35.9767,-122.594
x2y0,35.9767,-122.583
x0y1,35.9857,-122.605
x1y1,35.9857,-122.594
x2y1,35.9857,-122.583
x0y2,35.9947,-122.605
x1y2,35.9947,-122.594
x2y2,35.9947,-122.583
The points in this file represent the lower left corner and are arranged in row major format, meaning lowest horizontal grid points first. Each point is a certain great circle distance away from its neighbors (1km). I want to create a grid overlay on a map which I've plotted using ggmap.
What I've tried or considered:
map.grid() - this is really not useful to me as I'm not looking for any kind of projection.
geom_vline() and geom_hline(). These look good but I don't have constant x and y intercepts on a plane. Moreover, once I create a grid, I'd like to use the grid to color against a density.
geom_rect() and geom_tile(). These look really promising and may be what I want. But I'm not able to find a good way of working with these.
I'd like to fill these grid boxes later with another parameter. Any suggestions on how I can create such a grid? This may be a trivial question but I don't know a lot of R yet.
Problem 2:
How can I store or hold such a grid so that I given a point (lat,lon), I can quickly get to that grid. In fact my whole back end is in C++ and can directly output the grid name x<n>y<n> directly against a given search point. I somehow am finding it difficult to count such points against grid points so that I can fill grid with a representative color.
I'm not sure if everything of what I'm saying is clear. Please tell me if I've to clarify something.
Also note that I've Googled quite a lot and not found relevant answers although some looked close.
Eg: This, ThisToo
Thanks for the help!

Is it possible to create a pie in pie chart in SPSS or R?

I know it is possible to create such double pie charts in excel like this:
http://chandoo.org/wp/2009/12/02/group-small-slices-in-pie-charts/
but can SPSS or R do this also?
In relation to R:
The answer to the title question is "yes" ... see ?pie
As for the second question, the one in the body - it would be possible but would involve some coding. You'd have to draw two pie charts side by side (which could be managed with two calls to pie) and use segments or arrows (and text if necessary) to do the additional components of the plot.
Here's a rough example:
That required the fig argument of par to get them side-by-side.
(That example required a little fiddling to get right, but it would be possible to write a function to automate the details.)
The main issue I can see would be 'why on earth would you do it?' -- pie charts are a poor way of conveying information of this form. There are alternatives that result in much better ability to distinguish values, and less bias (such as what you get when comparing nearly horizontal vs nearly vertical slices).

images ds3.js heatmap

I am having trouble determining if you can create a heatmap with DS3 or R that can map onto a list of icons. Specifically wanted to use little people icons like these http://goo.gl/Yt8CG and then show concentrations of activity onto them. I am fairly new to data visualization with DS3.js and R so I might not be doing the right google-fu. Thanks ahead of time if anyone can show me an example or let me know if you CAN do shading on icons not just dynamically generated blocks like http://bl.ocks.org/mbostock/4063318
The basic approach is no different from drawing a normal heatmap (see for example here). The only difference would be that instead of appending rectangles, you append a container for the graphic that you want to use.
Whether you would be able to adjust the shading depends on the graphic itself -- if it's a bitmap you're out of luck. If it's an SVG for example you can simply select the path inside that SVG and set the fill color just like you would for a rectangle in a normal heatmap.

Resources