- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Windows > JMP > R Integration > R color names to JMP colors?
Hi JMP Community,
I am currently working on a project based on the output of an R (WGCNA) program that returns cluster identification based on R color definition (see below for examples).
While I can manually retrieve the RGB code for each R color, I am looking for an automated solution to this tedious task. Has anybody automated this process?
Examples of R colors:
darkorange
orange
darkgrey
darkturquoise
darkgreen
darkred
royalblue
lightyellow
lightgreen
grey60
lightcyan
midnightblue
cyan
salmon
tan
greenyellow
purple
magenta
pink
black
grey
red
green
yellow
brown
blue
turquoise
Thank you.
Best regards,
TS
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Windows > JMP > R Integration > R color names to JMP colors?
https://r-charts.com/colors/ displays the color name and RGB Hex values for R Colors. JMP colors can be made from RGB Values. To me at quick glance the R color names seem to be the same as the X Windows list of color names and values. https://en.wikipedia.org/wiki/X11_color_names The R function rib( r, g, b, alpha) returns an R color given an RGBA value on [0,1] . To go the other way use the
col2rgb(
"peachpuff"
)
to returnf the RGB values for the color name Peachpuff. see: https://www.geeksforgeeks.org/convert-a-color-to-its-rgb-value-in-r-programming-col2rgb-function/
rinit();
rsubmit("\[
r <- "red"
values <- col2rgb(r)
]\");
rgb = rget(values);show(rgb);jmp_c = RGB Color(rgb)
/*:
[255, 0, 0] -16711680
Which is the same return as RGB Color( 1.0, 0,0 0.0 )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Windows > JMP > R Integration > R color names to JMP colors?
https://r-charts.com/colors/ displays the color name and RGB Hex values for R Colors. JMP colors can be made from RGB Values. To me at quick glance the R color names seem to be the same as the X Windows list of color names and values. https://en.wikipedia.org/wiki/X11_color_names The R function rib( r, g, b, alpha) returns an R color given an RGBA value on [0,1] . To go the other way use the
col2rgb(
"peachpuff"
)
to returnf the RGB values for the color name Peachpuff. see: https://www.geeksforgeeks.org/convert-a-color-to-its-rgb-value-in-r-programming-col2rgb-function/
rinit();
rsubmit("\[
r <- "red"
values <- col2rgb(r)
]\");
rgb = rget(values);show(rgb);jmp_c = RGB Color(rgb)
/*:
[255, 0, 0] -16711680
Which is the same return as RGB Color( 1.0, 0,0 0.0 )
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Windows > JMP > R Integration > R color names to JMP colors?
For those using R with JMP, JMP 19 brings a rewrite of the R integration. Please checkout EA-7 and higher. It is still being polished up and finalized. The updated R integration is now built on top of the Python Integration using a jmpex package supplied as part of our Sample Scripts/Python. This is a pure Python package that utilizes rpy2 package to marshal between JMP, Python, and R. This gives you a familiar API from Python that mimics the JSL interface. The JSL interface now calls through to the jmpex package. Given that we are publishing the package as a sample, you have the ability to tinker with the code yourself, or just see how it works. If there is something critical that I missed, you have the capability to fix it before we are able to address with another JMP release. The jmpex package supports both the JSL and Python interfaces. The jmpex package also serves as an example on creating an installable Python package.
Feedback on bug fixes and enhancements is welcome.
In JMP 18 and earlier, all interaction, every JSL R command caused an interchange file to be written to the filesystem. Which was then accessed by the process calling R. Everything went through the filesystem. Using rpy2 all transfers and interactions now occur in memory. There are some minimal deprecations of the JSL interface due to running one top of the Python Integration, and differences between rpy2 and the previous external process that interacted with R.
The scripting index has been updated in 19 for the JSL functionality and the jmpex package.
You need to have R installed and R_HOME environment variable set before installing jmpex or running R Init() the first time. R Init() will automatically make the attempt to install jmpex from the SAMPLE_SCRIPTS/Python directory if not already installed. Python user's will need to either run R Init() once or use jmputils.jpip() to install the jmpex.zip file.
import jmp import os from jmputils import jpip jpip('install', [ os.path.join(jmp.SAMPLE_SCRIPTS, 'Python', 'jmpex.zip') ] )