我希望创建一个直方图,条形之间没有间隙。试图添加参数<?php
session_start();
include '../database/login-dbh.php';
$email = $_POST['email'];
$pwd = $_POST['pwd'];
$sql = "SELECT * FROM user WHERE email= ? ";
$stmt = mysqli_prepare($conn, $sql);
mysqli_stmt_bind_param($stmt, 's', $email);
mysqli_stmt_execute($stmt);
$result = mysqli_stmt_get_result($stmt);
$row = mysqli_fetch_assoc($result);
if(password_verify($pwd, $row['password'])) {
$_SESSION['id'] = $row['id'];
$userID = $row['id'];
header("Location: ../index.php?id=$userID");
exit();
} else {
header("Location: ../index.php?error=login");
exit();
}
?>
或bin
,但没有成功。
range
答案 0 :(得分:0)
您需要使用bins
参数来调整使用哪些容器。
import numpy as np
from matplotlib import pyplot as plt
population = 100
possible_answers = 4
scores = np.random.choice(range(possible_answers),population)
plt.hist(scores, bins=range(possible_answers+1), ec="k")
plt.show()
或者,如果你想转移垃圾箱
plt.hist(scores, bins=np.arange(possible_answers+1)-0.5, ec="k")