我想为 ggplot2 中的条形图边框着色。
以下脚本是一个示例。
如您所见,橙色边框与蓝色边框重叠。有什么方法可以避免这种行为并为图表内的边框着色吗?
library(tidyverse)
dat <- tibble(
dx = c("D+","D+","D-","D-"),
test = c("T+","T-","T+","T-"),
num = c(40,80,100,800)
)
ggplot(dat) +
geom_col(aes(x = dx, y = num, fill = dx, color = test),
size = 3) +
scale_color_manual(values = c("orange","blue"))
Run Code Online (Sandbox Code Playgroud)
我是马尼姆的新手。
如下例所示,
class scene_example(Scene):
def construct(self):
txt1 = Text("Text1")
txt2 = Text("Change to this text without animation")
self.play(FadeIn(txt1))
self.play(ReplacementTransform(txt1, txt2))
Run Code Online (Sandbox Code Playgroud)
有什么方便的功能可以将txt1“替换”为txt2吗?(即,没有“变形”动画?)
class scene_example(Scene):
def construct(self):
txt1 = Text("Text1")
txt2 = Text("Change to this text without animation")
self.play(FadeIn(txt1))
self.play(FadeOut(txt1), FadeIn(txt2) )
Run Code Online (Sandbox Code Playgroud)
这段代码将执行我想要的操作,但我觉得可能有像 ReplacemnetTransform 这样的函数来实现简单的“替换”动画。我尝试为 FadeIn 和 FadeOut 创建一个函数,但是这不起作用。
class q(Scene):
def construct(self):
def Replace(self, mObj1, mObj2):
self.play(FadeIn(mObj1),FadeOut(mObj2))
txt1 = "HI"
txt2 = "HI2"
self.play(FadeIn(txt1))
Replace(txt1, txt2)
Run Code Online (Sandbox Code Playgroud)