我想用chatjs创建类型line
的图表。问题是,我将日期格式设置为:{ x: real number from 0 to 1, y: integers from 0 to infinite }
,并且我希望在x轴上将固定标签固定在图表上,例如:[0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1]
。
这是我想要设置图表配置的方式:
type: 'line',
data: {
labels: ['0', '0.1', '0.2', '0.3', '0.4', '0.5', '0.6', '0.7', '0.8', '0.9', '1'],
datasets: [{
label: 'data',
data: [
{ x: 0.3, y: 446 },
{ x: 0.3331, y: 6863 },
{ x: 0.874, y: 12 },
{ x: 0.2244, y: 1565 },
{ x: 0.38899, y: 32221 },
{ x: 0.23685545, y: 3112324 },
{ x: 0.11332, y: 444423 },
{ x: 0.97694, y: 21212334 },
],
}]
},
但这显然行不通,我该怎么办?
答案 0 :(得分:0)
因此,我发现还有另一种图表类型#
# example setup
#
import random
out_channel_of_first = random.randint(1,16)
kernel_size_of_first = random.choice([3,5,7,11])
grayscale_image_shape = (1, 48, 48)
color_image_shape = (3, 48, 48) # alternative example
#
# example usage
#
print('the output shape will be', shape_of_output(
shape_of_input=grayscale_image_shape,
list_of_layers=[
nn.Conv2d(
in_channels=grayscale_image_shape[0],
out_channels=out_channel_of_first,
kernel_size=kernel_size_of_first,
),
nn.ReLU(),
nn.MaxPool2d(2,2),
# next major layer
nn.Conv2d(
in_channels=out_channel_of_first,
out_channels=5,
kernel_size=3
),
nn.ReLU(),
nn.MaxPool2d(2,2),
],
))
。通常仅将其用于轴图表上的点,但可以将其配置为在点之间具有线。另外,如果不需要在图形上标记这些点,则可以使用配置选项将这些点的半径设置为scatter
,这会使这些点隐藏。
https://www.chartjs.org/docs/latest/charts/scatter.html#scatter-chart