Skip to content

Commit

Permalink
Add origin and cmap config options
Browse files Browse the repository at this point in the history
  • Loading branch information
enourbakhsh committed Feb 21, 2024
1 parent 537b17e commit c3b3ff6
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion python/lsst/analysis/tools/actions/plot/matrixPlot.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,16 @@ class MatrixPlot(PlotAction):
default="matrix",
)

matrixOrigin = ChoiceField[str](
doc="Determines the starting corner ('upper', 'lower') for matrix plots.",
default="upper",
allowed={
"upper": "The origin is at the upper left corner.",
"lower": "The origin is at the lower left corner.",
},
optional=True,
)

component1Key = Field[str](
doc="The key to access a list of names for the first component set in a correlation analysis. This "
"will be used to determine x-axis tick values and labels.",
Expand Down Expand Up @@ -146,6 +156,12 @@ class MatrixPlot(PlotAction):
optional=True,
)

colorbarCmap = Field[str](
doc="The colormap to use for the colorbar.",
default="viridis",
optional=True,
)

vmin = Field[float](
doc="The vmin value for the colorbar.",
default=None,
Expand Down Expand Up @@ -365,7 +381,9 @@ def makePlot(self, data: KeyedData, plotInfo: Mapping[str, str] | None = None, *

# Set the colorbar and draw the image.
norm = ImageNormalize(vmin=vrange[0], vmax=vrange[1])
img = ax.imshow(matrix, interpolation="none", norm=norm)
img = ax.imshow(
matrix, interpolation="none", norm=norm, origin=self.matrixOrigin, cmap=self.colorbarCmap
)

# Calculate the aspect ratio of the image.
ratio = matrix.shape[0] / matrix.shape[1]
Expand Down

0 comments on commit c3b3ff6

Please sign in to comment.