Re: [R-es] MAPA DE CALOR

2020-12-04 Thread Francisco Rodríguez
Como consejo general, pasarse a sf tiene sus ventajas, totalmente de acuerdo 
con el comentario, yo ahora estoy trabajando con estos objetos m�s que con los 
.shp, un saludo



Enviado desde mi Galaxy



 Mensaje original 
De: Francisco Rodriguez Sanchez 
Fecha: 4/12/20 19:14 (GMT+01:00)
Para: r-help-es@r-project.org
Asunto: Re: [R-es] MAPA DE CALOR

Hola Pedro,

A ver si esto te sirve. Estoy usando la informaci�n sobre pa�ses de
RNaturalEarth en formato 'sf', pero tambi�n puedes trabajar con objetos
'sp' o usar otras fuentes geogr�ficas, claro.

Para mapear tu variable solamente tendr�as que hacer un join (merge) de
tu data frame con el objeto pa�ses, e indicar el nombre de la variable a
mapear (argumento fill en ggplot2 o zcol en mapview). Evidentemente
puedes cambiar multitud de cosas en el mapa si buceas un poco en la
ayuda de estas funciones.


library(rnaturalearth)

paises <- ne_countries(returnclass = 'sf')


 Versi�n ggplot (est�tico)

library(ggplot2)

ggplot() +
   geom_sf(data = paises, aes(fill = pop_est), size = 0.1) +
   scale_fill_distiller(palette = "YlOrRd", direction = 1) +
   theme_void()


 Mapa leaflet (interactivo)

library(mapview)

mapview(paises, zcol = "pop_est")


Saludos

Paco


On 4/12/20 17:33, Pedro Jos� Mart�nez C�rdoba wrote:
> Buenas tardes, amig@s:
>
> Estoy intentando realizar un mapa de calor con todos los pa�ses del
> mundo para representar una sola variable. He consultado un ejemplo
> (https://rpubs.com/daianaemili/mapas_con_R) que es muy similar a la idea
> que quiero reproducir, pero tengo un problema en descargar el �shapefile
> mundial�.
>
> �Alguien podr�a orientarme con alg�n otro ejemplo m�s did�ctico?
>
> Muchas gracias.
>
> Un saludo.
>
--
Dr Francisco Rodr�guez-S�nchez
https://frodriguezsanchez.net


[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R-es] MAPA DE CALOR

2020-12-04 Thread Francisco Rodriguez Sanchez
Hola Pedro,

A ver si esto te sirve. Estoy usando la información sobre países de 
RNaturalEarth en formato 'sf', pero también puedes trabajar con objetos 
'sp' o usar otras fuentes geográficas, claro.

Para mapear tu variable solamente tendrías que hacer un join (merge) de 
tu data frame con el objeto países, e indicar el nombre de la variable a 
mapear (argumento fill en ggplot2 o zcol en mapview). Evidentemente 
puedes cambiar multitud de cosas en el mapa si buceas un poco en la 
ayuda de estas funciones.


library(rnaturalearth)

paises <- ne_countries(returnclass = 'sf')


 Versión ggplot (estático)

library(ggplot2)

ggplot() +
   geom_sf(data = paises, aes(fill = pop_est), size = 0.1) +
   scale_fill_distiller(palette = "YlOrRd", direction = 1) +
   theme_void()


 Mapa leaflet (interactivo)

library(mapview)

mapview(paises, zcol = "pop_est")


Saludos

Paco


On 4/12/20 17:33, Pedro José Martínez Córdoba wrote:
> Buenas tardes, amig@s:
>
> Estoy intentando realizar un mapa de calor con todos los países del
> mundo para representar una sola variable. He consultado un ejemplo
> (https://rpubs.com/daianaemili/mapas_con_R) que es muy similar a la idea
> que quiero reproducir, pero tengo un problema en descargar el “shapefile
> mundial”.
>
> ¿Alguien podría orientarme con algún otro ejemplo más didáctico?
>
> Muchas gracias.
>
> Un saludo.
>
-- 
Dr Francisco Rodríguez-Sánchez
https://frodriguezsanchez.net


[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] How to save Results in svg format

2020-12-04 Thread David Carlson
Another option is to open the svg file in Inkscape which is a vector-based
editor. If you are planning to do this and work with the text labels, it is
easier to use svglite() in the package of the same name which draws text as
characters that can be selected and edited more easily than in files saved
with svg(). To see the difference look at the following files in a plain
text editor:

svg("Test.svg")

plot(0:1, 0:1, axes=FALSE, pch="", xlab="", ylab="")

text(.5, .5, "HELLO", cex=5)

dev.off()


library(svglite)

svglite("Testlite.svg")

plot(0:1, 0:1, axes=FALSE, pch="", xlab="", ylab="")

text(.5, .5, "HELLO", cex=5)

dev.off()

David L Carlson

On Fri, Dec 4, 2020 at 2:55 AM Spencer Graves <
spencer.gra...@effectivedefense.org> wrote:

>   I often have trouble with font sizes in the svg files, because
> they
> rarely are the same as what I see on the screen.  I then have to read
> the documentation for "par" and play with the cex, cex.axis, cex.lab,
> cex.main, and cex.sub parameters until I get what I want in the svg
> file.  I may also need to play with the "mar" argument in "par".
> Occasionally, I may also have to research some of the other plot
> parameters.
>
>
>   In some cases, I may also need a png file.  I can use "png" in
> the
> same way as "svg", but the cex, etc., parameters must be set
> differently.  I've recently learned how to open an svg file in the free
> open-source software GIMP and adjust the "Resolution" from the 90
> pixels/in default to something more like 300 to get what I want.  I
> couldn't import an svg file recently into a Google Doc.  The 90 pixels
> per inch default conversion didn't look very clean and sharp after
> imported into a Google Doc.  I tried 600 pixels/in and found that Google
> Doc looked like it accepted it at first.  However, when I went back
> later, I found that it had subsequently malfunctioned.  I tried 300
> pixels/in, and I think that worked, though I'm not 100% certain.
>
>
>   hope this helps.
>   Spencer Graves
>
>
> On 2020-12-03 23:21, David Carlson wrote:
> > If you look at the examples on the manual pages for the upgma() and NJ()
> > functions you will see that the results are generally sent to the plot()
> > function. To save that graph as an .svg file you need to open a graphics
> > device using the svg() function, plot the data, and close the graphics
> > device. You probably need something like the following:
> >
> > svg("UPGMA_5x5.svg")
> > plot(UPGMA_5x5)
> > dev.off()
> >
> > or
> >
> > svg("NJ_119x119.svg")
> > plot(NJ_119x119)
> > dev.off()
> >
> > There are numerous arguments that set various details for the plot that
> you
> > should look at (?svg).
> >
> > David L Carlson
> > Texas A University
> >
> >
> > On Thu, Dec 3, 2020 at 10:24 PM Anas Jamshed 
> > wrote:
> >
> >> #Loading the required libraries
> >> library(ape)
> >> library(phangorn)
> >> library(seqinr)
> >> #Importing the required file
> >> align_5 <- read.alignment("C:/Users/VAMSI/align 5.fasta", format =
> "fast")
> >> align_119 <- read.alignment("C:/Users/VAMSI/align 119.fasta", format =
> >> "fasta")
> >> Computing the distance matrix for both UPGMA and NJ algorithms
> >> implementation.
> >>   matrix_5x5 <- dist.alignment(align_5, matrix = "identity")
> >> summary(matrix_5x5)
> >>
> >> matrix_119x119 <- dist.alignment(align_119, matrix = "identity")
> >> summary(matrix_119x119)
> >> #Implementation of UPGMA algorithm for a small matrix (5x5) and entire
> >> matrix (119x119)
> >> UPGMA_5x5 <- upgma(matrix_5x5)
> >> UPGMA_119x119 <- upgma(matrix_119x119)
> >> summary(UPGMA_5x5)
> >>
> >> summary(UPGMA_119x119)
> >> #Implementation of NJ algorithm for a small matrix (5x5) and entire
> >> matrix (119x119)
> >> NJ_5x5 <- NJ(matrix_5x5)
> >> NJ_119x119 <- NJ(matrix_119x119)
> >> summary(NJ_5x5)
> >>
> >> summary(NJ_119x119)
> >>
> >>
> >> I have done this whole analysis but don't know how can I  the save my
> >> tree file in svg or some other image format . In the avove script , I
> >> am applying the phylogenetic algorithm on the distance matrix which I
> >> have created through fasta file
> >>
> >>  [[alternative HTML version deleted]]
> >>
> >> __
> >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >>
> >>
> https://urldefense.com/v3/__https://stat.ethz.ch/mailman/listinfo/r-help__;!!KwNVnqRv!T-8PRCLc041aD-rW1ehtb14tfQAVpWdpBddf_q6Raeho0RbG9wDodEK_QDpGMCc$
> >> PLEASE do read the posting guide
> >>
> https://urldefense.com/v3/__http://www.R-project.org/posting-guide.html__;!!KwNVnqRv!T-8PRCLc041aD-rW1ehtb14tfQAVpWdpBddf_q6Raeho0RbG9wDodEK_1H9sJRs$
> >> and provide commented, minimal, self-contained, reproducible code.
> >>
> >
> >   [[alternative HTML version deleted]]
> >
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >
> 

[R-es] MAPA DE CALOR

2020-12-04 Thread Pedro José Martínez Córdoba
Buenas tardes, amig@s:

Estoy intentando realizar un mapa de calor con todos los países del 
mundo para representar una sola variable. He consultado un ejemplo 
(https://rpubs.com/daianaemili/mapas_con_R) que es muy similar a la idea 
que quiero reproducir, pero tengo un problema en descargar el “shapefile 
mundial”.

¿Alguien podría orientarme con algún otro ejemplo más didáctico?

Muchas gracias.

Un saludo.

-- 
*Pedro José Martínez Córdoba*
Department of Financial Economics and Accounting
Faculty of Economy and Business
Campus Espinardo, 30100 – Murcia - Spain
*University of Murcia*

[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] How to save Results in svg format

2020-12-04 Thread Spencer Graves
	  I often have trouble with font sizes in the svg files, because they 
rarely are the same as what I see on the screen.  I then have to read 
the documentation for "par" and play with the cex, cex.axis, cex.lab, 
cex.main, and cex.sub parameters until I get what I want in the svg 
file.  I may also need to play with the "mar" argument in "par". 
Occasionally, I may also have to research some of the other plot 
parameters.



	  In some cases, I may also need a png file.  I can use "png" in the 
same way as "svg", but the cex, etc., parameters must be set 
differently.  I've recently learned how to open an svg file in the free 
open-source software GIMP and adjust the "Resolution" from the 90 
pixels/in default to something more like 300 to get what I want.  I 
couldn't import an svg file recently into a Google Doc.  The 90 pixels 
per inch default conversion didn't look very clean and sharp after 
imported into a Google Doc.  I tried 600 pixels/in and found that Google 
Doc looked like it accepted it at first.  However, when I went back 
later, I found that it had subsequently malfunctioned.  I tried 300 
pixels/in, and I think that worked, though I'm not 100% certain.



  hope this helps.
  Spencer Graves


On 2020-12-03 23:21, David Carlson wrote:

If you look at the examples on the manual pages for the upgma() and NJ()
functions you will see that the results are generally sent to the plot()
function. To save that graph as an .svg file you need to open a graphics
device using the svg() function, plot the data, and close the graphics
device. You probably need something like the following:

svg("UPGMA_5x5.svg")
plot(UPGMA_5x5)
dev.off()

or

svg("NJ_119x119.svg")
plot(NJ_119x119)
dev.off()

There are numerous arguments that set various details for the plot that you
should look at (?svg).

David L Carlson
Texas A University


On Thu, Dec 3, 2020 at 10:24 PM Anas Jamshed 
wrote:


#Loading the required libraries
library(ape)
library(phangorn)
library(seqinr)
#Importing the required file
align_5 <- read.alignment("C:/Users/VAMSI/align 5.fasta", format = "fast")
align_119 <- read.alignment("C:/Users/VAMSI/align 119.fasta", format =
"fasta")
Computing the distance matrix for both UPGMA and NJ algorithms
implementation.
  matrix_5x5 <- dist.alignment(align_5, matrix = "identity")
summary(matrix_5x5)

matrix_119x119 <- dist.alignment(align_119, matrix = "identity")
summary(matrix_119x119)
#Implementation of UPGMA algorithm for a small matrix (5x5) and entire
matrix (119x119)
UPGMA_5x5 <- upgma(matrix_5x5)
UPGMA_119x119 <- upgma(matrix_119x119)
summary(UPGMA_5x5)

summary(UPGMA_119x119)
#Implementation of NJ algorithm for a small matrix (5x5) and entire
matrix (119x119)
NJ_5x5 <- NJ(matrix_5x5)
NJ_119x119 <- NJ(matrix_119x119)
summary(NJ_5x5)

summary(NJ_119x119)


I have done this whole analysis but don't know how can I  the save my
tree file in svg or some other image format . In the avove script , I
am applying the phylogenetic algorithm on the distance matrix which I
have created through fasta file

 [[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

https://urldefense.com/v3/__https://stat.ethz.ch/mailman/listinfo/r-help__;!!KwNVnqRv!T-8PRCLc041aD-rW1ehtb14tfQAVpWdpBddf_q6Raeho0RbG9wDodEK_QDpGMCc$
PLEASE do read the posting guide
https://urldefense.com/v3/__http://www.R-project.org/posting-guide.html__;!!KwNVnqRv!T-8PRCLc041aD-rW1ehtb14tfQAVpWdpBddf_q6Raeho0RbG9wDodEK_1H9sJRs$
and provide commented, minimal, self-contained, reproducible code.



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.