我需要创建多个条形图。我可以这样:
Require Import List.
Require Import Arith.
Require Import Coq.Sorting.Sorting.
Definition stack_disk :=
fun (n:nat) (l:list nat) =>
match l with
| nil => n::nil
| n'::l' =>
if n' <? n
then n::l
else l
end.
Lemma ordered_stacking: forall (n:nat) (l:list nat),
StronglySorted le l -> StronglySorted le (stack_disk n l) -> StronglySorted le (n::l).
Proof.
intros n [|m l].
- intros _ _; repeat constructor.
- simpl. intros H1 H2.
destruct (Nat.ltb_spec m n); trivial.
constructor; trivial.
apply StronglySorted_inv in H1.
destruct H1 as [_ H1].
constructor; trivial.
revert H1; apply Forall_impl.
now intros p; apply Nat.le_trans.
Qed.
但是,如果我有10个变量或16个变量怎么办? O应该手动创建条形图吗?
另一种选择是使用fig, axes = plt.subplots(nrows=2, ncols=2)
ax0, ax1, ax2, ax3 = axes.flat
ax0.hist(tweets["red"])
ax0.set_title('Red in backgrounds')
ax1.hist(tweets["red"][tweets["candidate"] == "trump"].values)
ax1.set_title('Red in Trump tweeters')
ax2.hist(tweets["blue"])
ax2.set_title('Blue in backgrounds')
ax3.hist(tweets["blue"][tweets["candidate"] == "trump"].values)
ax3.set_title('Blue in Trump tweeters')
plt.tight_layout()
plt.show()
,但是图表非常小,我无法控制其大小。