Scatter Plot (Marker Trace): Order of marker/dot plotting?

Hi,

I'm creating a scatter plot (maker trace) that colors the markers depending on a given Z-value according to a colorscale.

My problem is that although the points are defined by XYZ coordinates, they are not sorted by Z value. Because of this, the markers are not plotted in order from low Z-value to high Z-value. Many of the markers inevitably overlap, but I would like to have those of higher Z-value plotted on top of those of lower Z-value so that the view of markers with high Z-value is never obscured by those with lower z-value.

I was wondering if anyone could suggest a way for me to make it so that the markers are appended to the graph in the order of lowest Z-value to highest Z-value. Either that or a way for the markers to get sorted by Z-value once they have been appended to the graph.

The way I'm graphing is by using a procedure file I've created to import the data from files, and then graph the data.

Thanks very much