BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
gandi2223
Community Trekker

Label multiple images to show in graph

When a column with images is set as a label, hovering over a datapoint in a graph shows the resp. image. Is it possible to do this for multiple images (in different columns)? Setting several columns as label doesn't work, only the image of the first column is shown.

0 Kudos
4 REPLIES 4
cwillden
Super User

Re: Label multiple images to show in graph

I'm almost certain that if JMP intended for that to be possible, what you tried would have worked. I could be wrong.
-- Cameron Willden
0 Kudos
Highlighted
cwillden
Super User

Re: Label multiple images to show in graph

You could always try appending the images together into a single column.  That would probably take some work, but it could certainly be scripted.  I'm not an expert on handling images in scripts, but I'm certain it's do-able.

-- Cameron Willden
txnelson
Super User

Re: Label multiple images to show in graph

I will add that I think you should add this suggestion to the JMP Wish List for addition to a future release

Jim
d_barnett
Community Trekker

Re: Label multiple images to show in graph

Although this isn't the completed solution and will need a bit of work to get to suit your needs Julia Gong made a script for combining images which could be used https://community.jmp.com/t5/JMP-Scripts/Banner-fying-Images/ta-p/23899

 

//open desired images to "blend" in order; here they are "image1" and "image2"
image1 = open("C:\Users\YOUR_NAME\Documents\YOUR_IMAGE.jpg", jpg);
image2 = open("C:\Users\YOUR_NAME\Documents\YOUR_OTHER_IMAGE.jpg", jpg);
//banner = open("C:\Users\jugong\Documents\Images\Banner.jpg", jpg); //template with correct W:H ratio

//retrieve dimensions of each picture
//{banCols, banRows} = banner << getSize();
banCols = 1400; banRows = 425; //correct dimensions; use other template if 1400x425 not desired
{image2Cols, image2Rows} = image2 << getSize();
{image1Cols, image1Rows} = image1 << getSize();

//determine the necessary H and W of resulting image (as big as possible)
image2ColsScaled = Floor(image2Cols / (banCols * 0.55)) * banCols;
image1ColsScaled = Floor(image1Cols / (banCols * 0.55)) * banCols;
image2RowsScaled = Floor(image2Rows / banRows) * banRows;
image1RowsScaled = Floor(image1Rows / banRows) * banRows;

width = min(image2ColsScaled, image1ColsScaled);
height = Round((banRows / banCols) * width);

//crop images (truncate, not resize)
image2A = newImage(image2);
image2A << crop(left(1), right(Round(width * 0.55)), top(0), bottom(height));
image1A = newImage(image1);
image1A << crop(left(1), right(Round(width * 0.55)), top(0), bottom(height));
{image2Cols, image2Rows} = image2A << getSize();
//new window(" ", image2A);

//retrieve r, g, b, matrices for original images
{r, g, b} = image2A << getPixels("rgb");
{r2, g2, b2} = image1A << getPixels("rgb");

//create matrices for new banner image
matR = J(height, width, 0);
matG = J(height, width, 0);
matB = J(height, width, 0);
matA = J(height, width, 1);

//position the two images in the new banner
//first image placed
for(i = 1, i <= height, i++,
	for(j = 1, j <= image2Cols, j++,
		matR[i, j] = r2[i, j];
		matG[i, j] = g2[i, j];
		matB[i, j] = b2[i, j];
	);
);

//second image placed
for(i = 1, i <= height, i++,
	for(j = image2Cols, j >= 1, j--,
		matR[i, (j + (width - image2Cols))] = r[i, j];
		matG[i, (j + (width - image2Cols))] = g[i, j];
		matB[i, (j + (width - image2Cols))] = b[i, j];
	);
);

//left side blending
for(i = 1, i <= height, i++,
	for(j = 1, j <= width / 2, j++,
		matA[i, j] = 1 - (j / width) * 2.2;
	);
);

//right side blending
missed = 0;
for(i = 1, i <= height, i++,
	index = 1;
	for(j = width, j >= width / 2, j--,
		matA[i, j] = 1 - (index / width) * 2.2;
		index++;
		if(matA[i, j] > 0.904, missed++;);
	);
);
missed /= height;

//blending the middle
for(i = 1, i <= height, i++,
	for(j = width / 2 - missed, j <= width / 2 + missed, j++,
		matA[i, j] = 0.003;
	);
);

//create new image and save to directory (if desired)
img = newImage("rgba", {matR, matG, matB, matA});
new window("LinkedIn Banner", img);
//img << saveImage("C:\Users\YOUR_NAME\Documents\YOUR_BANNER_NAME.png", png); //make sure to use png!