Gibbsdavidl / CatterPlots

Did you ever wish you could make scatter plots with cat shaped points? Now you can!
245 stars 40 forks source link

Want to customize graph with my own cat's face #7

Open alin44 opened 7 years ago

alin44 commented 7 years ago

How can I use my own kitty's face as catterplot points??

Gibbsdavidl commented 7 years ago

With a small amount of work you can use any image. Please see: https://github.com/Gibbsdavidl/CatterPlots/blob/master/R/cat_loader.R

First clone this repo. Then get a png of your cat's face and put it in some directory like 'mykitty'. Then call 'createCatList(mykitty)' as listed in the file above. This returns a list of bitmaps. Save that list as 'data/cats.rda' in the cloned dir. Then reinstall the package. R CMD INSTALL CatterPlots.... give it a try!

katherinelauck commented 4 years ago

So I know this was years ago. I've been really enjoying catterplots and would love to mod it into birdrplots (no, I won't make a new package. This would just be for me and my bird nerd friends). I've been reading your code but can't seem to figure out where you call createCatList or where sysdata.rda is used, and that is preventing me from understanding how to do this mod. Could you give me a nudge?

Thanks!

katherinelauck commented 4 years ago

Ooh also, what kind of image processing did you do to make the nice silhouettes?

Gibbsdavidl commented 4 years ago

Hi there! Sorry, I'm super slow. Work / family has been busy!

Glad you like it... in fact, go ahead and make a new package! That's fine. I love birds, especially the Northern Flicker.

It might take me a second to remember what I did... but I actually bought the cat silhouettes on Etsy. Someone was selling a pack of cat silhouettes, and when you buy them, you get a creative license. Then the were read in as bitmaps, which is just a matrix, and those were stored as a list. Since the images are black and white, the matrix is just 1s and 0s. I think conceptually, that's what happened.

I would bet you that there's bird silhouettes on Etsy too.

But I'll look at it...

-dave

Gibbsdavidl commented 4 years ago

Check out the bit about sysdata.rda here: http://r-pkgs.had.co.nz/data.html

katherinelauck commented 4 years ago

No worries about taking a few days to answer! Omg, I am stoked to hear back from you at all given how extremely not essential this is. Thanks for writing back! So, based on my reading of sysdata.rda, I can use devtools::use_data() to make a new version of sysdata.rda that includes birds (after processing the png files into a list using createCatList) and then reinstall CatterPlots.

So when I installed the package (I used devtools::install_github()), createCatList wasn't imported. Is that a bug or a feature, or the consequence of using the wrong install function?

On Mon, 27 Apr 2020 at 15:15, David L Gibbs notifications@github.com wrote:

Check out the bit about sysdata.rda here: http://r-pkgs.had.co.nz/data.html

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Gibbsdavidl/CatterPlots/issues/7#issuecomment-620264262, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALFTBH54D2AOHCFH2GWUSPTROX7XVANCNFSM4DG5FO7A .

-- Katherine (Katie) Lauck she/hers https://lgbtqia.ucdavis.edu/educated/pronouns

PhD student Karp Lab, UC Davis

Gibbsdavidl commented 4 years ago

Maybe!? Just go ahead and do some experiments... try calling the functions manually... meaning not really as part of an installed package.

I guess createCatList is sort of an 'internal' function... not exported in the namespace. I would just copy-paste it into the interpreter (or you know, actually import it). ;-)