Skip to content

Commit 8a82463

Browse files
committed
override title from DataFrame if title option is given
1 parent c0794d8 commit 8a82463

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

lib/gnuplotrb/plot.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ def new_with_options(options)
298298
end
299299

300300
def set_name_from_daru_dataframe(dataframe)
301-
self.title = dataframe.name
301+
self.title = dataframe.name unless title
302302
end
303303
end
304304
end

spec/plot_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@
5757
it 'takes name for plot from DataFrame' do
5858
expect(subject.title).to eql(df.name)
5959
end
60+
61+
context 'with title option given' do
62+
subject { Plot.new(df, title: 'Not a DataFrame') }
63+
64+
it "uses title option instead of DataFrame name" do
65+
expect(subject.title).not_to eql(df.name)
66+
end
67+
end
6068
end
6169
end
6270

0 commit comments

Comments
 (0)