I have a question about saving plotly table as an image. I wrote the following code:
import plotly.graph_objects as go
layout = go.Layout(autosize=True, margin={'l': 0, 'r': 0, 't': 0, 'b': 0})
fig = go.Figure(data=[go.Table(header=dict(values=['A Scores', 'B Scores']),
cells=dict(values=[[100, 90, 80, 90], [95, 85, 75, 95]]))
], layout=layout)
fig.write_image("fig1.png", scale=5)
Run Code Online (Sandbox Code Playgroud)
But unfortunately, there is a big white space at the bottom of the table.

Can I cut it from the image? The height setting doesn't fit because the table may have …
我使用 React 和 Antd 进行注册。当后端发送错误“用户已注册”时,点击“注册”后需要将其显示在表单中。
像这里或其他东西,但我输入用户名和两个密码:
来自服务器的响应,但我可以采用不同的方式:
{
"errorCode": "1",
"errorMessage": "user already registered"
}
Run Code Online (Sandbox Code Playgroud)
代码:
class RegisterPage extends React.Component {
// Method in which I send the request
signUp(values) {
fetch("http://localhost:8080/sign-up", {
method: "POST",
body: JSON.stringify({"username": values.username, "password": values.password})
}).then(response => response.json())
.then(response => {console.log(response)
})
}
render() {
return (
<>
<Header/>
<div className="container">
</div>
<Row type="flex" justify="center" align="middle" style={{minHeight: '80vh'}}>
<Form
name="normal_login"
className="login-form"
initialValues={{
remember: true,
}}
onFinish={this.signUp}
>
<Form.Item className="username-input"
name="username"
rules={[
{
required: true,
message: …Run Code Online (Sandbox Code Playgroud)