Dimensionality Reduction Plugin inconsistent dot colors run to run

Is there a way to get the dots to be the same colors on subsequent runs of Plugins>Dimensionality Reduction.
A dot size or shape in the classes file would also be helpful

Which plugin are you talking about, please?

Plugins>Dimensionality Reduction is not a part of standard Fiji. It would help if you specify which update site you’re using, or how you installed the plugin.

I got the plugin here

The author mentions that he has not requested an update site.

I can’t figure out how to reply with the download site.

just google it “Dimensionality Reduction Plugin inconsistent dot colors run to run - #2 by imagejan

Ah, you probably mean:

Pinging the author @antinos might help.

I noticed you opened an issue already:

(Note that it is best practice to disclose when cross-posting, so that others can follow the discussion as well :wink: )

1 Like

Hi @rondespain ,

Thanks for trying the plugin. As @imagejan astutely pointed out in the github issue thread, the Dimensionality Reduction plugin uses random 0-230 rgb number assignments to colour each dataset within the plot. I chose to do it this way as I wanted to make the plugin resilient to potentially large numbers of clusters or datagroups. However, as also suggested by Jan on Github, a good alternative approach would have been to use randomisation seeds. This should be an easy update to the plugin, so I will try to implement it when I find some time.
For now, this macro should help you:

 * Use a seed to recolour a plot. May not work well if multiple plots are open.
 * Make sure the Plot Values table is open before running. Use the 'List' button at the bottom of the plot window.

seed = 1; //Change this number to use a different palette
random("seed", seed);

selectWindow("Plot Values");
headingsString = Table.headings;
headingsArray = split(headingsString, "\t");

index = 0;
//Plot.create("Re-coloured plot", "X", "Y");
for (i = 0; i < headingsArray.length; i+=2) {
	selectWindow("Plot Values");
	xArray = Table.getColumn(headingsArray[i]);
	yArray = Table.getColumn(headingsArray[i+1]);

	r = round(random*230);
	g = round(random*230);
	b = round(random*230);
	rHex = toHex(r);
	gHex = toHex(g);
	bHex = toHex(b);
	hex = "#" + "ff" + "" + pad(rHex) + "" + pad(gHex) + "" + pad(bHex);
	///Plot.add(""+headingsArray[i+1], xArray, yArray);
	Plot.setStyle(index, ""+hex+","+hex+",5.0,Dot");

function pad(n) {
    n = toString(n);
    if(lengthOf(n)==1) n = "0"+n;
    return n;

The above macro should hopefully re-colour the DR plot with seed set pseudorandom colour palettes. As mentioned in the macro comment header, just make sure to have the ‘Plot Values’ table open before running the macro.

Kind regards.

Thanks Jan
I contacted antonios on github when I found his site to send to you. For some reason I was unable to paste the github URL into my imagesc replies. I see you have marked the imagesc request solved. The macro did work as advertised.

Thanks again