我尝试使用jzy3d
包创建表面图表。这是我的代码:
int stepsX = 6;
Range rX = new Range(1,6);
int stepsY = 7;
Range rY = new Range(0,6);
Mapper mapper = new Mapper(){
@Override
public double f(double x, double y) {
return //My function to get Z value;
}
};
// Create a surface drawing that function
org.jzy3d.plot3d.primitives.Shape surface = Builder.buildOrthonormal(new OrthonormalGrid(rX, stepsX, rY, stepsY), mapper);
surface.setColorMapper(new ColorMapper(new ColorMapRainbow(), surface.getBounds().getZmin(), surface.getBounds().getZmax(), new org.jzy3d.colors.Color(1, 1, 1, .5f)));
surface.setFaceDisplayed(true);
surface.setWireframeDisplayed(false);
//surface.setWireframeColor(org.jzy3d.colors.Color.GRAY);
// Create a chart and add the surface
org.jzy3d.chart.Chart chart = new org.jzy3d.chart.Chart(Quality.Advanced,"swing");
chart.getScene().getGraph().add(surface);
JPanel p = new JPanel(new BorderLayout());
p.add((JPanel)chart.getCanvas(),BorderLayout.CENTER);
使用以下代码我设置了默认颜色映射(蓝色表示较低值,红色表示较高值)。
surface.setColorMapper(new ColorMapper(new ColorMapRainbow(), surface.getBounds().getZmin(), surface.getBounds().getZmax(), new org.jzy3d.colors.Color(1, 1, 1, .5f)));
有没有办法反转颜色映射?即红色表示较低值,蓝色表示绿色表示较高值。
答案 0 :(得分:1)
由恶意解决。
我在if (error.code) {
cancelBlock = block;
UIAlertController *alert = [UIAlertController alertControllerWithTitle: @"Message"
message: @"Peripheral Disconnected with Error"
preferredStyle: UIAlertControllerStyleAlert];
UIAlertAction *alertAction = [UIAlertAction actionWithTitle: @"OK"
style: UIAlertActionStyleDestructive
handler: ^(UIAlertAction *action) {
NSLog(@"OK");
}];
[alert addAction: alertAction];
[self presentViewController: controller animated: YES completion: nil];
/* UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Peripheral Disconnected with Error"
message:error.description
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];*/
上使用了setDirection(false)
方法:
ColorMapRainbow
该方法反转与每个值关联的默认颜色,因此蓝色表示较高的值,红色表示较低的值。