cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Get the free JMP Student Edition for qualified students and instructors at degree granting institutions.
Choose Language Hide Translation Bar
View Original Published Thread

Windows > JMP > R Integration > R color names to JMP colors?

Thierry_S
Super User

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

Thierry R. Sornasse
1 ACCEPTED SOLUTION

Accepted Solutions


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 )

 

 

View solution in original post

2 REPLIES 2


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 )

 

 


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') ] )

Recommended Articles

No recommendations found