Mathematica - Colour each 2D point by a third coordinate for each point?

Click For Summary
The discussion focuses on plotting 2D data from imaging accretion discs around Kerr black holes, specifically how to visualize (x,y,z) coordinates in Mathematica. The user seeks to color each point based on the third coordinate, z, which could represent attributes like redshift. A provided code snippet demonstrates how to use the Hue function to achieve this coloring in Mathematica. Additionally, there is a mention of IDL as a preferred tool for astronomical plotting due to its handling of specific quirks in data representation. The user is experimenting with color schemes for negative and positive redshifts to enhance their visualization.
Ruf30
Messages
8
Reaction score
1
I'm looking, as an observer, at imaging accretion discs and tori around Kerr black holes. The image of the disc/torus is projected onto a 2D grid (a CCD if you like) so all lensing effects etc. are implicit. Basically, I can plot the image after determining the (x,y) coordinates in the 2D grid. Plotting 2D data using ListPlot and using the Import command for my .dat files (which are a list of (x,y) points) is no problem.

My question is this: How would one plot a list of (x,y,z) data in ListPlot, where each pixel/point is plotted as (x,y) and the third coordinate z (which can represent redshift, radial coordinate etc) is used to colour each pixel, i.e. its corresponding (x,y) coordinates?

Thank you
 
Mathematics news on Phys.org
I don't mind if anybody could tell me how to do this in IDL instead of Mathemtica say? I can use IDL on my university computers also. Anybody, please?
 
Using Mathematica, suppose your list is in the form L = {{x1,y1,z1},{x2,y2,z2},...,{xN,yN,zN}}, then you could generate a colored graphic using this snippet of code:

Graphics[{Hue[#3], Point[{#1, #2}]} & @@@ L, Frame -> True]

I am not sure how you want to turn your z coordinates into colors, so play around with the Hue function.

Also, although I love Mathematica and recommend it all the time, IDL is the best tool for producing astronomical plots e.g. some astro quirks like smaller magnitudes being brighter stars cause trouble when you try to make Mathematicaplot the y-axis with positive values below the x-axis and negative values above the x axis.
 
Last edited:
Thanks ExactlySolved, I think I've got it. Well, re: the redshift, I know hue varies between 0 and 1 and I'm playing with it right now. I want my negative redshifts to be coloured shades of green to blue and my positive redshifts shades of yellow-orange-red for increasing z. I've been playing with this for a few hours but have not, as of yet, figured out how to do this.

However, I now have nice colours, which is a start! Thank you again.
 
Here is a little puzzle from the book 100 Geometric Games by Pierre Berloquin. The side of a small square is one meter long and the side of a larger square one and a half meters long. One vertex of the large square is at the center of the small square. The side of the large square cuts two sides of the small square into one- third parts and two-thirds parts. What is the area where the squares overlap?

Similar threads

Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
8
Views
2K
  • · Replies 20 ·
Replies
20
Views
4K
Replies
5
Views
3K
Replies
2
Views
2K
Replies
20
Views
4K