gusl: (Default)
[personal profile] gusl
Dear LJ Genie,

Sometimes I make two-color scatterplots with o-shaped points. Occasionally, when I have a few thousand points, they bunch up and it really matters which color was plotted first: I can't see behind the color that was plotted last... except when Acrobat refreshes its window.
...which of course means it's possible to manipulate the elements of a PDF. But how?

Ideally, these points would be plotted at a random order (independent of color) AND would be semi-transparent. I'm not sure how to accomplish this easily with R's 'plot'.

(no subject)

Date: 2009-10-29 06:09 pm (UTC)
From: [identity profile] http://users.livejournal.com/_tove/
Do you have access to vector editing software? I don't know about Inkscape or any of the others, but it is definitely possible to do this in Illustrator.

(no subject)

Date: 2009-10-29 06:31 pm (UTC)
From: [identity profile] gustavolacerda.livejournal.com
Thanks.

My search term is now: PDF "vector graphics" library

(no subject)

Date: 2009-10-29 06:44 pm (UTC)
From: [identity profile] en-ki.livejournal.com
Urgh, why are we using an inky drawing model instead of a filtery one? It's not even true.

(no subject)

Date: 2009-10-29 06:51 pm (UTC)
From: [identity profile] bhudson.livejournal.com
If you output to ps instead of PDF, it might be not too hard to parse it hackishly and randomize the order of the points. It's normal for output to be relatively human-readable (ignore the crap at the top of the file, look for what is probably going to be a bunch of lines with a couple numbers and a single-letter command).

(no subject)

Date: 2009-10-29 07:11 pm (UTC)
From: [identity profile] zarex.livejournal.com
Illustrator should be able to edit native pdf's.

(no subject)

Date: 2009-10-29 08:03 pm (UTC)
From: [identity profile] http://users.livejournal.com/_tove/
Oh as an addendum, if you do find yourself doing this in Illustrator, note that it has the ability to "select all with the same [fill/stroke/fill+stroke]," which is incredibly useful for grabbing lots of little circles of the same color. You can then put them on different layers by color, and tweak the opacity of those layers.

If UBC has clusters you can use, they probably have Illustrator.

(no subject)

Date: 2009-10-29 08:34 pm (UTC)
From: [identity profile] gustavolacerda.livejournal.com
Thanks, but I'm not going to do this by hand (remember, thousands of points per image).
I'll need to work either via a library or the command line.

(no subject)

Date: 2009-10-29 09:16 pm (UTC)
From: [identity profile] bhudson.livejournal.com
I believe she said "select all" -- so thousands of points shouldn't be a problem. It being non-automatic is a problem if you want to do this more often than once per paper, granted.

(no subject)

Date: 2009-10-29 09:21 pm (UTC)
From: [identity profile] gustavolacerda.livejournal.com
oops! apologies for not reading carefully.

(no subject)

Date: 2009-10-29 09:21 pm (UTC)

(no subject)

Date: 2009-10-29 11:54 pm (UTC)
From: [identity profile] roseandsigil.livejournal.com
Inkscape has some sort of scripting ability, but I don't know what it is.

(no subject)

Date: 2009-10-30 12:41 am (UTC)
From: [identity profile] http://users.livejournal.com/_tove/
Yeah, I definitely wouldn't recommend doing this over and over, but it should honestly take under a minute to change the opacity of a two-color chart. I very rarely have generated images (whether by something like Processing or AutoCAD) that don't need any cleaning up in Illustrator.

R can do it

Date: 2009-10-30 05:35 am (UTC)
From: [identity profile] serapio.livejournal.com
You can make transparent colors with 8 digit color names. The last two digits are the alpha level.

1000 -> N
dat = data.frame(x=rnorm(N),y=rnorm(N),class=c(rep(1,N/2),rep(2,N/2)))
dat$col = ifelse(dat$class==1,"#ff000080","#0000ff80")
plot(dat$x,dat$y,col=dat$col,cex=2,lwd=5)

dat.rand = dat[sample(1:N,N),]
plot(dat.rand$x,dat.rand$y,col=dat.rand$col,cex=2,lwd=5)

February 2020

S M T W T F S
      1
2345678
9101112131415
16171819202122
23242526272829

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags